Re: SELECT statement

From: Date: Mon, 11 Dec 2000 21:12:50 +0000
Subject: Re: SELECT statement
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-5162@lists.php.net to get a copy of this message
* Julio Cuz, Jr. (jcuz@rccd.cc.ca.us) wrote: > Hi-- > > Let's say I'm doing this: > > $sql = "SELECT * FROM Facilities WHERE WO=$number"; > > What if "$number" doesn't exist OR is NOT an integer for example, how can I > trap that error and display a message? Or other idea? Use a technique I call 'building a query': $sql = "SELECT * FROM Facilities"; if (valid_number($number)) { $sql .= " WHERE WO=$number"; } ... just write a function to check the validity of $number, or use a quick expression. Does this answer your question? Mike -- Mike Erickson <mee(at)quidquam.com> http://www.quidquam.com/ "The more noise a man or a motor makes the less power there is available." - W. R. McGeary

« previous php.db (#5162) next »