请问这段代码为什么总是显示mysql error1064:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>address book browser</title>
</head>
<body>
<h2>address book browser</h2>
<form method="post" action="book.php" >
<?php
function check_mysql()
{
if (mysql_errno()>0)
{
die("<br>mysql error".mysql_errno().":".mysql_error());
}
}
$db = mysql_connect("localhost","root","study");
if(! $db)
{
die("failed to open connection to mysql server.");
}
mysql_select_db("maildb");
check_mysql();
if(!isset($id))
{
$id=0;
}
if(isset($left))
{
$query = "select id,name,email from addressbook where id<$id"."order by id desc";
$result = mysql_query($query);
check_mysql();
$row = mysql_fetch_row($result);
check_mysql();
if($row[0] > 0)
{
$id = $row[0];
$name = $row[1];
$email = $row[2];
}
}
elseif (isset($right))
{
$query = "select id,name,email from addressbook where id > $id"."order by id asc";
$resuit = mysql_query($query);
check_mysql();
$row = mysql_fetch_row($result);
check_mysql();
if($row[0]>0)
{
$id = $row[0];
$name = $row[1];
$email = $row[2];
}
}
elseif(isset ($search))
{
$id = 0;
$query = "select id,name,email from addressbook"."where name like '%$name%' and id > $id";
$result = mysql_query($query);
check_mysql();
$row = mysql_fetch_row($result);
check_mysql();
if($row[0] > 0)
{
$id = $row[0];
$name = $row[1];
$email = $row[2];
}
}
elseif(isset($add))
{
$query = "insert into addressbook"."(name,email)value('$name','$email')";
$result = mysql_query ($query);
check_mysql();
$id = mysql_insert_id();
$message = "record added (id = $id)";
}
elseif(isset($update))
{
$query ="update addressbook set name = '$name',email = '$email'"."where id = $id";
$result = mysql_query($query);
check_mysql();
$message = "record updated (id = $id)";
}
elseif(isset ($delete))
{
$query = "delete from addressbook where id = $id";
$result = mysql_query($query);
check_mysql();
$name ="";
$email = "";
$message ="record delete(id = $id)";
}
$name = trim($name);
$email = trim($email);
?>
<br>name:
<br><input type="text" name="name" <?php echo "value =\"$name\"" ?> >
<br>
<br>email address:
<br><input type="text" name="email" <?php echo "value =\"$email\"" ?> >
<br>
<br>
<input type="submit" name="left" value="<">
<input type="submit" name="right" value=">">
<input type="submit" name="search" value="search">
<br><Br>
<input type="submit" name="add" value="add">
<input type="submit" name="update" value="update">
<input type="submit" name="delete" value="delete">
<input type="hidden" name="id" <?php echo "value = \"$id\""?>>
<?php
if(isset($message))
{
echo "<br><br>$message";
}
?>
</form>
</body>
</html>