note 11359 added to settype
| From: | neoja at hotmail dot com | Date: | Sat, 17 Feb 2001 23:42:16 +0000 |
| Subject: | note 11359 added to settype | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-11191@lists.php.net to get a copy of this message | ||
It is always good to validate all the variables that are given in the url and would cause an error
if they are of wrong type. For example, if your page is products.php?id=123 then run settype($id,
"integer") in the script, before getting the product info from the database. If the user
enters a non-numeric value in the url -- either pasting it wrong or intentionally :) -- the $id will
be set to zero and database query will have no errors.
http://www.php.net/manual/en/function.settype.php