单击“AD RECORD”按钮时出现以下错误:
INSERT 失败:INSERT INTO user_master VALUES('cha' , 'rstein' , 'bar' , 'foo') 列计数与第 1 行的值计数不匹配
从以下代码:
if (isset($_POST['delete']) && isset($_POST['first']))
{
$first = get_post('first');
$query = "DELETE FROM user_master WHERE first='$first'";
if(!mysql_query($query, $db_server))
echo "DELETE failed: $query<br />" .
mysql_error() . "<br /><br />";
}
if (isset($_POST['first']) && isset($_POST['last']) && isset($_POST['user_name']) && isset($_POST['email']))
{
$first = get_post('first');
$last = get_post('last');
$email = get_post('email');
$user_name = get_post('user_name');
$query = "INSERT INTO user_master VALUES" . "('$first' , '$last' , '$user_name' , '$email')";
if(!mysql_query($query, $db_server)) echo "INSERT failed: $query <br />" . mysql_error() . "<br /><br />";
}
echo <<<END
<form action = "willingLog.html" method="post"><pre>
First <input type="text" name="first" />
Last <input type="text" name="last" />
Email <input type="text" name="email" />
Username <input type="text" name="user_name" />
<input type="submit" value="AD RECORD" />
</pre></form>
END;