Jump to content

help with a WHERE condition


co.ador

Recommended Posts

<pre>Array

(

    [frmSearch] => Array

        (

            [zipcode] =>

            [food_types] => Array

                (

                    [0] => 5

                )

 

            [submit] => Submit

 

</pre>

above is the print_r of the POST global variable coming from page1

 

in page2 I want to display three fields from table stores based on some condition met with the form values.

 

The thing is that foodtypes input field is an array and I am trying to fit the results of foodtypes inside the query where the fields from table store are to be display. I am trying to script it at the WHERE clause.

 

 

so far I have this.

 

<?php 
// Extract the form POST variables and escape them

$strZipCode = isset($_REQUEST['frmSearch']['zipcode'])? mysql_real_escape_string($_REQUEST['frmSearch']['zipcode']):'';
    $arrFoodTypes = isset($_REQUEST['frmSearch']['food_types'])? ($_REQUEST['frmSearch']['food_types']):array();

//query to display three fields from stores based on the form input.
$query4 = "SELECT state, zip, county,restaurantname,restaurant_id
FROM stores
WHERE zip= '$strZipCode' OR restaurantname='$strName' OR state='$strState' OR restaurant_id=". $arrFoodTypes[0]."";

?>

 

the above condition at the WHERE zip is not working

 

 

help please.....

Link to comment
https://forums.phpfreaks.com/topic/187023-help-with-a-where-condition/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.