When mysql_query returns false

后端 未结 5 1105
南旧
南旧 2020-12-30 10:00

Aside from writing the wrong query and not having permissions to access a table, when mysql_query returns false? Are there any other cases?

5条回答
  •  离开以前
    2020-12-30 10:13

    Thank you for your comment.
    I am sure there is absolutely no need to dig into such details.

    A thing you really need is error message which you can read and thus get informed of the particular problem.

    So, it seems that mysql_error() function is really what you're looking for.

    $res = mysql_query($sql) or trigger_error(mysql_error()." in ".$sql);
    

    looks sufficient enough.

提交回复
热议问题