note 37591 deleted from security.database by didou
| From: | didou@php.net | Date: | Thu, 20 Nov 2003 13:09:09 +0000 |
| Subject: | note 37591 deleted from security.database by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-60688@lists.php.net to get a copy of this message | ||
Note Submitter: Kmos@TondelaOnline.com
----
Although I can see the use of is_numeric(), I hardly ever use it.
Hold on! Before you think I'm insane, let me explain why.
Most of the time, when I'm dealing with a numeric input, it's most likely an auto
incremented unsigned integer. I'm not sure about other databases, but MySQL starts numbering
those columns at 1, so I just intval the incoming variable and handle it at the same time as I would
catch an unset or 0 value.
-----
You also can use this for SQL queries:
$sql=sprintf("SELECT * FROM table WHERE id='%d';", $id);
It only accept numeric stuff, and if you try to input some string it will return false (zero), and
that's it..
- http://Kmos.TondelaOnline.com
- I'm a lost soul in this lost world...