need help with php parse error
-
i am working on a project and on a page i get this error. Parse error: parse error in C:\wamp\www\RMS\comresult.php on line 143 line 143 is the last line of my code. Please i need help.
-
Well I'm afraid we cannot guess what is on line 143; or any other line. Please show the code, especially the line where the error occurs.
Line 143 is the last line "". This is my code.
<?php
include("conn.php");
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Welcome :: Result Portal</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
body {
background-color: #FFF;
}
</style>
<!--[if IE]>
<script src="ie/dist/html5shiv.js"></script>
<script src="ie/dist/html5shiv-printshiv.js"></script>
<![endif-->
<script type="text/javascript">
function bk(){
location.assign(document.referrer);
}
var state = true;function getstate(){
return state;
}
</script>
</head><body onload="print()">
<?php
if(isset($_GET['lev'],$_GET['sem'],$_GET['prog'],$_GET['sess'])){
$level = $mysqli->real_escape_string(trim($_GET['lev']));
$sem = $mysqli->real_escape_string(trim($_GET['sem']));
$prog = $mysqli->real_escape_string(trim($_GET['prog']));
$sess = $mysqli->real_escape_string(trim($_GET['sess']));$sql = "SELECT \* FROM course\_tb WHERE level LIKE '".$level."' AND semester LIKE '".$sem."'"; if($result = $mysqli->query($sql)){ if($result->num\_rows > 0){ $sel = "SELECT DISTINCT regno FROM st\_result\_data WHERE level LIKE '".$level."' AND semester LIKE '".$sem."' AND programme LIKE '".$prog."'"; if($res = $mysqli->query($sel)){ if($res->num\_rows > 0){ //$sel2 = "SELECT \* FROM st\_result\_data WHERE regno LIKE '".$row\['regno'\]."' AND level LIKE '".$level."' AND semester LIKE '".$sem."' AND programme LIKE '".$row\['programme'\]."'"; //if($res2 = $mysqli->query($sel2)){ //if($res2->num\_rows > 0){ ?>
-
Line 143 is the last line "". This is my code.
<?php
include("conn.php");
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Welcome :: Result Portal</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
body {
background-color: #FFF;
}
</style>
<!--[if IE]>
<script src="ie/dist/html5shiv.js"></script>
<script src="ie/dist/html5shiv-printshiv.js"></script>
<![endif-->
<script type="text/javascript">
function bk(){
location.assign(document.referrer);
}
var state = true;function getstate(){
return state;
}
</script>
</head><body onload="print()">
<?php
if(isset($_GET['lev'],$_GET['sem'],$_GET['prog'],$_GET['sess'])){
$level = $mysqli->real_escape_string(trim($_GET['lev']));
$sem = $mysqli->real_escape_string(trim($_GET['sem']));
$prog = $mysqli->real_escape_string(trim($_GET['prog']));
$sess = $mysqli->real_escape_string(trim($_GET['sess']));$sql = "SELECT \* FROM course\_tb WHERE level LIKE '".$level."' AND semester LIKE '".$sem."'"; if($result = $mysqli->query($sql)){ if($result->num\_rows > 0){ $sel = "SELECT DISTINCT regno FROM st\_result\_data WHERE level LIKE '".$level."' AND semester LIKE '".$sem."' AND programme LIKE '".$prog."'"; if($res = $mysqli->query($sel)){ if($res->num\_rows > 0){ //$sel2 = "SELECT \* FROM st\_result\_data WHERE regno LIKE '".$row\['regno'\]."' AND level LIKE '".$level."' AND semester LIKE '".$sem."' AND programme LIKE '".$row\['programme'\]."'"; //if($res2 = $mysqli->query($sel2)){ //if($res2->num\_rows > 0){ ?>
-
I can only suggest that you go through the code and remove sections one at a time until the error disappears. You will then be able to see which section is the cause and correct it.
-
I can only suggest that you go through the code and remove sections one at a time until the error disappears. You will then be able to see which section is the cause and correct it.
this is the problem.
<?php
$sql = "SELECT * FROM course_tb WHERE level LIKE '".$level."' AND semester LIKE '".$sem."'";
if($result = $mysqli->query($sql)){
if($result->num_rows > 0){
while($rw = $result->fetch_array()){
?><? }}} ?>
whenver i try to loop through $result->fetch_array() it returns the Parse Error.
-
this is the problem.
<?php
$sql = "SELECT * FROM course_tb WHERE level LIKE '".$level."' AND semester LIKE '".$sem."'";
if($result = $mysqli->query($sql)){
if($result->num_rows > 0){
while($rw = $result->fetch_array()){
?><? }}} ?>
whenver i try to loop through $result->fetch_array() it returns the Parse Error.
-
this is the problem.
<?php
$sql = "SELECT * FROM course_tb WHERE level LIKE '".$level."' AND semester LIKE '".$sem."'";
if($result = $mysqli->query($sql)){
if($result->num_rows > 0){
while($rw = $result->fetch_array()){
?><? }}} ?>
whenver i try to loop through $result->fetch_array() it returns the Parse Error.
You have used a short PHP opening tag "
<?
" inside the loop instead of the full tag "<?php
" - ifshort_open_tag
is disabled in yourphp.ini
, then this will cause a parse error. -
this is the problem.
<?php
$sql = "SELECT * FROM course_tb WHERE level LIKE '".$level."' AND semester LIKE '".$sem."'";
if($result = $mysqli->query($sql)){
if($result->num_rows > 0){
while($rw = $result->fetch_array()){
?><? }}} ?>
whenver i try to loop through $result->fetch_array() it returns the Parse Error.