note 74073 added to function.filter-var
| From: | georgedotenciuatdesignmysoftware dot com at osu1 dot php dot net | Date: | Thu, 22 Mar 2007 21:56:40 +0000 |
| Subject: | note 74073 added to function.filter-var | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-124734@lists.php.net to get a copy of this message | ||
the filter_var function is a very good function for preventing some sql injections.
in the example below we make sure that the entity that we pass to the sql query is an int
$getID = filter_var($_GET['id'],FILTER_VALIDATE_INT);
$sql = 'SELECT * FROM myTable WHERE id = '.$getID;
----
Server IP: 69.147.83.197
Probable Submitter: 80.96.148.135
----
Manual Page -- http://www.php.net/manual/en/function.filter-var.php
Edit -- https://master.php.net/note/edit/74073
Del: integrated -- https://master.php.net/note/delete/74073/integrated
Del: useless -- https://master.php.net/note/delete/74073/useless
Del: bad code -- https://master.php.net/note/delete/74073/bad+code
Del: spam -- https://master.php.net/note/delete/74073/spam
Del: non-english -- https://master.php.net/note/delete/74073/non-english
Del: in docs -- https://master.php.net/note/delete/74073/in+docs
Del: other reasons-- https://master.php.net/note/delete/74073
Reject -- https://master.php.net/note/reject/74073
Search -- https://master.php.net/manage/user-notes.php