如何检查使用旧版API的MySQL查询是否成功? [英] How to check if a MySQL query using the legacy API was successful?
本文介绍了如何检查使用旧版API的MySQL查询是否成功?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
除了使用die()
我正在努力实现...
I'm trying to achieve...
mysql_query($query);
if(success){
//move file
}
else if(fail){
//display error
}
推荐答案
This is the first example in the manual page for mysql_query
:
$result = mysql_query('SELECT * WHERE 1=1');
if (!$result) {
die('Invalid query: ' . mysql_error());
}
如果您想使用die
以外的其他方式,那么我建议 trigger_error
.
If you wish to use something other than die
, then I'd suggest trigger_error
.
这篇关于如何检查使用旧版API的MySQL查询是否成功?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文