- 论坛徽章:
- 0
|
<?php
include("config.php");
$connect = mysql_pconnect($host, $sql_user, $sql_pw) || die('error:'.mysql_error());
mysql_select_db($db)|| die('無法連接資料庫('.$db.'):'.mysql_error());
if(isset($_POST["Submit"])){
$updata = "UPDATE info_table SET name='$_POST[name]', content='$_POST[info]' WHERE id=$_GET[id]";
mysql_query($updata)|| die('error);
header('Location: index.php');
exit;
}else{
$sql = "SELECT * FROM info_table WHERE id=$_GET[id]";
$result = mysql_query($sql);
$result || die('error '.$sql);
$record = mysql_fetch_array($result);
}
?>
<form name="form1" method="post" action="">
<table width="600" border="1" align="center" cellpadding="5" cellspacing="0" bordercolor="#9999FF">
<tr>
<td width="23%"><div align="right">姓名:</div></td>
<td width="77%"><input name="name" type="text" id="name" value=<?php echo "$record[name]";?>></td>
</tr>
<tr>
<td valign="top"><div align="right">內容:</div></td>
<td><textarea name="info" cols="48" rows="5" id="info"><?php echo "$record[info]";?></textarea></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input type="submit" name="Submit" value="送 出">
</div></td>
</tr>
</table>
</form>
上面的码错在哪?
那段updata一直执行不到,就是一直只会执行die('error');这句而不执行updata query!为什么?
[ 本帖最后由 hg70hg70 于 2009-3-3 22:35 编辑 ] |
|