Jump to content

[SOLVED] Parse error: syntax error, unexpected '>' in C:\wamp\www\new.php on line 38


Recommended Posts

Hi all,

 

I have pasted the PHP code I wrote below. I do not know why, but I am getting the parse error: unexpected '>'. It says the error is on line 38. The exact line on line 38 is

echo"<tr>\n

 

Basically, I am trying to execute an sql query through PHP which tries to extract data from the mysql database and display the data in the browser. The query is running fine but I am getting the problems when I try to display the data in the browser.

 

Can anyone help me with it?

 

Thanks,

Sashi

 

 

<?php
/* CONNECTS TO THE DATABASE*/
$host="********";
$user="********";
$password="********";
$dbname="********";
$cxn=mysqli_connect($host, $user, $password, $dbname);
if (!$cxn=mysqli_connect($host, $user, $password, $dbname))
{
	$error=mysqli_error($cxn);
	echo "$error";
	die();
}
else
{
	echo "Connection established successfully";
}
$sql="select * FROM OCCUPANCY";
$data=mysqli_query($cxn,$sql);
if (!$data=mysqli_query($cxn,$sql))
{
	$error=mysqli_error($cxn);
	echo "$error";
	die();
}
else
{
	echo "Query sent successfully";
}
echo "<br>";
echo "<html>";
echo "<h1>OCCUPANCY<h1>";
echo "<table cellspacing='5'>";
echo "<tr><td colspan='7'><hr /></td></tr>;
while ($row=mysqli_fetch_array($data))
{
	extract($row);
	echo"<tr>\n
	     <td>$building</td>\n
	     <td>$parking_lot</td>\n
	     <td>$month</td>\n
	     <td>$day</td>\n
	     <td>$occupancy</td>\n
	     <td>$empty_spaces</td>\n
	     <td>$special_days</td>\n
	     </tr>\n";
	echo "<tr><td colspan='7'><hr /></td></tr>\n";
}
	echo"</table>\n";
echo "</html>";
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.