开发者

preventing a specific mysqli_fetch_assoc() from sending a warning

I use a specific que开发者_如何学Cry that is acting weird: On my local environment, it works perfect and sends no warning. Online, the query itself works fine, however, mysqli_fetch_assoc($result) is producing the 'mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given' warning.

I never occured a query that was causing this warning AND got the right info from the DB. This is why I tend to believe the problem is not in the code.

Is there a way to shut off the warnings only for this one specific query?

EDIT -

PROBLEM SOLVED.

it is really strange to me, but the problem was an incorrect script src path for dojo.js. I have no idea what's the connection, but fixing the path prevented mysqli warnings.


You should be checking if $result == false before you call mysqli_fetch_assoc. Generally you catch it first by checking mysqli_connect_errno() but the general idiom is to proactively check before fetching rows

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜