Warning: mysql_query() expects parameter 2 to be resource, boolean given in C:\wamp\www\pyrll\emlhome.php on line 15

前端 未结 2 1230
情歌与酒
情歌与酒 2021-01-26 16:38

I\'ve tried other answers similar to mine but in vain.

Here is the code.



        
相关标签:
2条回答
  • 2021-01-26 16:57

    The problem is exactly what the error message says.

    Line 15 is:

    mysql_query($insdb,$con);//line 15
    

    $con is defined on line 3.

    $con=isset($_POST['con']);
    

    This is indeed a boolean indicating if $_POST['con'] exists. mysql_query expects a 2nd parameter that indentifies the connection (whatever mysql_connect returns) -if- you define it. I don't think that is needed here, so simply remove the second parameter and I think it should work.

    0 讨论(0)
  • 2021-01-26 17:04

    Use mysql_error()

    Returns the text of the error message from previous MySQL operation

    http://www.php.net/manual/en/function.mysql-error.php

    0 讨论(0)
提交回复
热议问题