-6

<?php
error_reporting(E_ALL);
$con=mysql_connect("localhost","root","");
$db=mysql_select_db("TB_DB",$con);

if(isset($_POST['submit']))
{
 $sql="INSERT INTO `tv-circuits` ( `part-name`, `model-no`, `price`) VALUES ('".$_POST['prt-name']."', '".$_POST['mdl-no']."', '".$_POST['price']."')";
 
$res=mysql_query($sql);

?>
<!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>Anirudha's TV appliances</title>
</head>
<h1 align="center"><strong>Admin Panel</strong></h1>
<body>
<form action="" method="post">
<table align="center">
<tr><td>Enter Part Name </td><td><input type="text" name="prt-name"  /></td></tr>
<tr><td>Enter Model-No </td><td><input type="text" name="mdl-no"  /></td></tr>
<tr><td>Enter Price</td><td><input type="number" name="price"  /></td></tr>
<tr align="center"><td colspan="2"><input type="submit" value="Save-Data" name="submit" /></td></tr>
</table>
</form><br />
<table border="1" align="center">
<tr align="center">
<td width="67"><strong>Sr.no</strong></td>
<td width="143"><strong>Part-Name</strong></td>
<td width="143"><strong>Model-No</strong></td>
<td width="93"><strong>Price</strong></td>
<td width="125"><strong>Operations</strong></td>
</tr>
<?php 
$i=1;
$sql="SELECT * from tv-circuits";
$res=mysql_query($sql);
while($row=mysql_fetch_array($res))
{
?>
<tr>
<td><?php echo $row['i'];?></td>
<td><?php echo $row['part-name'];?></td>
<td><?php echo $row['model-no'];?></td>
<td><?php echo $row['price'];?></td>
<td align="center"><a href="index.php?viewid=<?php echo $row['part-name'];?>" ><strong>VIEW</strong></a>
<a href="index.php?delid=<?php echo $row['part-name'];?>" ><strong>DELETE</strong></a>
<a href="index.php?editid=<?php echo $row['part-name'];?>" ><strong>EDIT</strong></a></td>
</tr>

<?php $i=$i+1; }?>
</table>
</body>
</html>

I am creating a a Page that will show, update and delete the user entered values

On the HTML page I am getting this error..

Parse error: syntax error, unexpected $end in C:\wamp\www\TV-DB\index.php on line 56

I seen all the possibilities but don't know how this error occured!!!!

The page coding is this...

Image is showing the error in the code

1 Answers1

1

You have forgotten to close the } for the if clause above. Try closing it after HTML.

<?php $i=$i+1; }?>
</table>
</body>
</html>
<?php
}
?>
Megan Fox
  • 435
  • 2
  • 6
  • 20