楼主的代码...........试试下面的if  (!isset($_POST["isbn"])&& !!isset($_POST["author"]&&!!isset($_POST["title"]&&!!isset($_POST["price"])  
{  
echo  "You  have  not  entered  all  the  required  details.<br>"."please  go  back  and  try  again";  
exit;  
}  
$isbn=addslashes  ($isbn);  
$author=addslashes  ($author);  
$title  =addslashes  ($title);  
$price=doubleval  ($price);  
 
@$db=mysql_pconnect("localhost","root","");  //确保这里你的数据库server和用户名无错
if  (!$db)  
{  
           echo  "Error:Could  not  connect  to  database,Please  try  again  later.";  
           exit  ;  
}  
mysql_select_db("books");  
$query="insert  into  book  values('".$isbn."','".$author."','".$title."','".$price."')";  echo  $query  //输出sql  用于调试if  (mysql_query($query))  
           echo  mysql_affected_rows()."book  inserted  into  database";  
?>

解决方案 »

  1.   

    wellwell, first of all, you should know you must
    do it step by step when you write source code.
    The work flow should be1. write the static html code
    2. get the posted data by php after submiting the form.
    $isbn=addslashes($_POST['isbn']);
    .....
    3. write an additional php file to only connect to mysql
    print a msg for getting connection
    4. embed the connection code to the main php file, or
    simply include it
    5. write more statement for your dababase handling stuff..