Question
PHP+MySQL query with empty value
Hi!
Software is DW8 with Apache 2.0.48, MySQL ver. 4.0.15a, PHP 4.2.3.
We had problem when a submitted value for 'regionID' in the submit page
was left blank and the following error message appears in the result page:
"You have an error in your SQL syntax. Check the manual that corresponds
to your MySQL server version for the right syntax to use near 'LIMIT 0,
3' at line 1"
The problem was solved by adding at the top of the page:
<?php
if (isset($_POST['regionID']) && empty($_POST['regionID'])) {
$_POST['regionID'] = '0';
}
?>
How to change the above code to retrieve ALL records when an empty \
blank value is submitted for 'regionID'?
TIA
Nanu
Software is DW8 with Apache 2.0.48, MySQL ver. 4.0.15a, PHP 4.2.3.
We had problem when a submitted value for 'regionID' in the submit page
was left blank and the following error message appears in the result page:
"You have an error in your SQL syntax. Check the manual that corresponds
to your MySQL server version for the right syntax to use near 'LIMIT 0,
3' at line 1"
The problem was solved by adding at the top of the page:
<?php
if (isset($_POST['regionID']) && empty($_POST['regionID'])) {
$_POST['regionID'] = '0';
}
?>
How to change the above code to retrieve ALL records when an empty \
blank value is submitted for 'regionID'?
TIA
Nanu
