note 75947 added to function.mysql-real-escape-string
| From: | soundefined at gmail dot com | Date: | Sat, 23 Jun 2007 02:32:59 +0000 |
| Subject: | note 75947 added to function.mysql-real-escape-string | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-127896@lists.php.net to get a copy of this message | ||
An update on Example 1428. A "Best Practice" query
if (isset($_POST['product_name']) &&
isset($_POST['product_description']) && isset($_POST['user_id'])) {
...........
}
else {
echo "Fill the form properly\n";
}
The condition above will still put empty data into a database even though forms are empty. The
condition should be corrected to code below. It checks empty fields in a form and handle errors.
if (!empty($_POST['product_name']) &&
!empty($_POST['product_description']) && !empty($_POST['user_id'])) {
...........
}
else {
echo "Fill the form properly\n";
}
----
Server IP: 64.71.164.2
Probable Submitter: 69.255.65.191
----
Manual Page -- http://www.php.net/manual/en/function.mysql-real-escape-string.php
Edit -- https://master.php.net/note/edit/75947
Del: integrated -- https://master.php.net/note/delete/75947/integrated
Del: useless -- https://master.php.net/note/delete/75947/useless
Del: bad code -- https://master.php.net/note/delete/75947/bad+code
Del: spam -- https://master.php.net/note/delete/75947/spam
Del: non-english -- https://master.php.net/note/delete/75947/non-english
Del: in docs -- https://master.php.net/note/delete/75947/in+docs
Del: other reasons-- https://master.php.net/note/delete/75947
Reject -- https://master.php.net/note/reject/75947
Search -- https://master.php.net/manage/user-notes.php