help with script

Codes here !

Moderators: egami, macek, gesf

Post Reply
php-forum Fan User
php-forum Fan User
Posts: 622
Joined: Fri Aug 05, 2011 9:53 am

Wed Sep 19, 2012 11:08 pm

You should always check that a query has executed successfully before you try and use the return value. So depending on what your $db database type is, you may need to check if $db->query($sql) returns false as this may indicate a problem with the query.

Note that this depends entirely on what $db is and you will have to work it out from any information you have, but the main idea is:
Execute some SQL
Did this fail?
Report error and exit
// Must have worked so...
foreach Result Set
Do something with each row

Post Reply