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

前端 未结 2 1229
情歌与酒
情歌与酒 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.

提交回复
热议问题