排除故障第一步:
   输出查询语句, 如果查询语句可以在 PHPmyadmin执行成功,说明此语句正常,招连接的事情
排除故障第二部:
   检查数据连接,多半是这里的问题
排除故障第三部:
   换一个肯定正确的查询语句,看能不能执行成功如果这三部都不行的话,小弟弟, 大哥我是无能为力了!

解决方案 »

  1.   

    先谢谢大哥了。
    我是初学的,什么也不懂,我估计查询语句也正常。
    您说检查数据连接,具体怎么做啊,能说具体清楚吗?
    我试过添加、修改数据都可以成功,会不会是php要什么设置?
      

  2.   

    你应该会用select取出数据吧,如果能正常取出来显示,那说明连接没问题,我估计你的问题在,php没有正常连接数据库吧。第二个问题,可以通过配置php.ini来实现,short_open_tag = On
      

  3.   

    取出数据没问题。
    我用下面的语法:
    mysql_connect($mysql_server_name,$mysql_username,$mysql_password or trigger_error(mysql_error(),E_USER_ERROR));
    mysql_select_db($mysql_databasec);
    $sql="DELETE FROM gbook WHERE id='$id' ";
    $result=mysql_query($sql);
    mysql_close($conn);
    出现下面的错误:
    Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: YES) in D:\wamp\www\del.php on line 9Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'ODBC'@'localhost' (using password: NO) in D:\wamp\www\del.php on line 10Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in D:\wamp\www\del.php on line 10Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in D:\wamp\www\del.php on line 12Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in D:\wamp\www\del.php on line 12Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in D:\wamp\www\del.php on line 13
    这是什么意思?
      

  4.   

    第一步就错了。先检查$mysql_server_name,$mysql_username,$mysql_password的值对不对。