【发布时间】:2016-11-03 15:27:23
【问题描述】:
<?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>
我正在创建一个页面,它将显示、更新和删除用户输入的值
在 HTML 页面上我收到此错误..
解析错误:语法错误,第 56 行 C:\wamp\www\TV-DB\index.php 中的意外 $end
我看到了所有的可能性,但不知道这个错误是怎么发生的!!!
页面编码是这样的……
【问题讨论】:
-
你能告诉我们什么是错误吗?你也可以在这里粘贴代码吗?
-
最好不要在图片中发布代码
-
发布代码以及如何处理所有内容以及完整的错误消息
-
尝试从
$row['$i'];中删除$ -
在 HTML 页面上我收到此错误..> 解析错误:语法错误,第 56 行 C:\wamp\www\TV-DB\index.php 中的意外 $end
标签: php html phpmyadmin