Revision: 17207
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 27, 2009 02:08 by acosonic
Initial Code
$sql="select something from something_else"; $res_id=mysql_query($sql); if (!$res_id) { $message = 'Invalid query: ' . mysql_error() . "\n"; $message .= 'Whole query: ' . $sql; die($message); }
Initial URL
Initial Description
Dumps whole query so developer can see where is error. However it's potential security issue, exposing SQL commands to attacker. (Recommended to use only during development, replace message code with some custom error text)
Initial Title
Mysql query in PHP with proper error detection
Initial Tags
mysql, php
Initial Language
PHP