help with script

Codes here !

Moderators: macek, egami, gesf

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

Re: help with script

Post by NigelRen » 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

Who is online

Users browsing this forum: No registered users and 2 guests