Ok, Im getting an error in this php code.
code
if(isadmin()) {
if($_POST['city']!='' || $_POST['zip']!='')
{
if($_POST['zip']!='')
$result = mysql_query("SELECT * FROM prerecycle WHERE zip='$_POST[zip]' ORDER BY zip");
else if($_POST['city']!='')
$result = mysql_query("SELECT * FROM prerecycle WHERE city='$_POST[city]' ORDER BY zip");}
}
else
{
if($_POST['city']!='' || $_POST['zip']!='') {
if($_POST['zip']!='')
$result = mysql_query("SELECT * FROM prerecycle WHERE zip='$_POST[zip]' AND show='1' ORDER BY zip");
else if($_POST['city']!='')
$result = mysql_query("SELECT * FROM prerecycle WHERE city='$_POST[city]' AND show='1' ORDER BY zip");}
}
if(mysql_num_rows($result)=0')
{
while($row = mysql_fetch_array($result))
{
----------------------------------------------------------------------------------
there error is at
if($_POST['zip']!='')
$result = mysql_query("SELECT * FROM prerecycle WHERE zip='$_POST[zip]' AND show='1' ORDER BY zip");
else if($_POST['city']!='')
$result = mysql_query("SELECT * FROM prerecycle WHERE city='$_POST[city]' AND show='1' ORDER BY zip");}
the AND show='1' part
is causing the mySQL error. If i remove it, then it work fine. is that syntax correct?
here an image of the code (i made a few minor changes but it's still the same)
http://img52.imageshack.us/img52/8043/codeq.png
Thanks to whoever that can help! I'll give best answer to first who get this right!!
I get this error :
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 '[show] = '1' ORDER BY zip' at line 1
code
if(isadmin()) {
if($_POST['city']!='' || $_POST['zip']!='')
{
if($_POST['zip']!='')
$result = mysql_query("SELECT * FROM prerecycle WHERE zip='$_POST[zip]' ORDER BY zip");
else if($_POST['city']!='')
$result = mysql_query("SELECT * FROM prerecycle WHERE city='$_POST[city]' ORDER BY zip");}
}
else
{
if($_POST['city']!='' || $_POST['zip']!='') {
if($_POST['zip']!='')
$result = mysql_query("SELECT * FROM prerecycle WHERE zip='$_POST[zip]' AND show='1' ORDER BY zip");
else if($_POST['city']!='')
$result = mysql_query("SELECT * FROM prerecycle WHERE city='$_POST[city]' AND show='1' ORDER BY zip");}
}
if(mysql_num_rows($result)=0')
{
while($row = mysql_fetch_array($result))
{
----------------------------------------------------------------------------------
there error is at
if($_POST['zip']!='')
$result = mysql_query("SELECT * FROM prerecycle WHERE zip='$_POST[zip]' AND show='1' ORDER BY zip");
else if($_POST['city']!='')
$result = mysql_query("SELECT * FROM prerecycle WHERE city='$_POST[city]' AND show='1' ORDER BY zip");}
the AND show='1' part
is causing the mySQL error. If i remove it, then it work fine. is that syntax correct?
here an image of the code (i made a few minor changes but it's still the same)
http://img52.imageshack.us/img52/8043/codeq.png
Thanks to whoever that can help! I'll give best answer to first who get this right!!
I get this error :
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 '[show] = '1' ORDER BY zip' at line 1