如何检查使用旧版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.