duanduanxi9441 2016-07-01 09:19
浏览 44
已采纳

PHP页面中的解析错误[重复]

This question already has an answer here:

<?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

</div>
  • 写回答

1条回答 默认 最新

  • dpca31461 2016-07-01 10:42
    关注

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

    <?php $i=$i+1; }?>
    </table>
    </body>
    </html>
    <?php
    }
    ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 各位请问平行检验趋势图这样要怎么调整?说标准差差异太大了
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 wpf界面一直接收PLC给过来的信号,导致UI界面操作起来会卡顿
  • ¥15 init i2c:2 freq:100000[MAIXPY]: find ov2640[MAIXPY]: find ov sensor是main文件哪里有问题吗
  • ¥15 运动想象脑电信号数据集.vhdr
  • ¥15 三因素重复测量数据R语句编写,不存在交互作用
  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab