Re: error handling in query execution

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Chenri wrote:
i have a script that
update records with this construct:


while( .... ){ query_string='UPDATE .......'; updateRecord(query_string);

}

the problem is when there are wrong query_string (such as incorect syntax)
can i make sure that the other query, the next one after the wrong query
still goes.


I've read about the @ operand but i still doesn't understand does the script stop when the error occured or does it still continue the process

Cherni,

your updateRecord() function must handle the query error thats all.
the '@' sign is there to repress errors so that they don't show up on screen
or in your log. you may need to use the '@' to stop a warning from
being emitted when you pass a bad query.... (you don't say which DB you use
and I haven't used mysql in a long time)

whether or not the script stops depends on what kind of error occurs.
FATAL errors are exactly that, WARNINGs don't always need to be a show
stopper it depends on your error checking/handling.

to be honest though if you are buidling the SQL string then there is no reason
for the SQL to be invalid. just make sure to check and sanitize all the variables
you wan't to place inside the query (e.g. searching for name or selecting on id, etc)



-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux