我正在尝试使用我创建的编辑表单中的新信息更新 mysql 数据库。我不能把手指放在哪里出了问题。该代码弹出一个mysql错误。有任何想法吗?
<?php
// connect to datebase
require "episodelist.db.php";
// real escape all strings
$season_num = mysql_real_escape_string($_POST['season_num']);
$eps_num = mysql_real_escape_string($_POST['eps_num']);
$temp_eps_num = mysql_real_escape_string($_POST['temp_eps_num']);
$title = mysql_real_escape_string($_POST['title']);
$inspired = mysql_real_escape_string($_POST['inspired']);
$descrip = mysql_real_escape_string($_POST['descrip']);
// update data in mysql database
$sql="UPDATE $season SET season_num='$season_num', eps_num='$eps_num', temp_eps_num='$temp_eps_num', title='$title', inspired='$inspired', descrip='$descrip' WHERE id='$id'";
$result=mysql_query($sql);
// if successfully updated.
if($result){
echo "Successful";
echo "<BR>";$result=mysql_query($sql);
echo "<a href='../episodelist_superadmin.html'>View result</a>";
}
else {
echo "Whoops: " . mysql_error(); ;
}
mysql_close();
?>