note 37591 added to security.database
| From: | Kmos at TondelaOnline dot com | Date: | Thu, 20 Nov 2003 11:48:32 +0000 |
| Subject: | note 37591 added to security.database | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-60681@lists.php.net to get a copy of this message | ||
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...
----
Manual Page -- http://www.php.net/manual/en/security.database.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+37591
Delete -- http://master.php.net/manage/user-notes.php?action=delete+37591&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+37591&report=yes
Search -- http://master.php.net/manage/user-notes.php