Jump to content

Search from Checkbox


techker
Go to solution Solved by Barand,

Recommended Posts

Hey guys im going nuts here..i have a car dealership script to do for my budy and i want to do a multiple search for by make..

 

so i got a litle test script im doing to figure out the results..

 

 

 
$search_string = "'" . implode( "','", $search ) . "'" ;$q3 = "select * from `cars` where Make  in ('$search_string') ORDER BY `Make` ASC LIMIT 0 , 30 ";$result = mysql_query($q3);                      while($info = mysql_fetch_array($result)){ echo $info['Make'];  }echo "select * from `cars` where Make  in ({$search_string} ) was selected!\n"; 
 
So the odd think is i cant get an echo results of it..
 
so i echo a txt base line to see what the query is.
 
i get
(selected Acura and BMW)
 
select * from `cars` where Make in ('Acura','BMW' ) was selected!
 
So if i paste in phpmyadmin
 
select * from `cars` where Make in ('Acura','BMW' )
 
works perfect..
 
so why does it not echo?(i just put Make to test for now)
 
thx
Link to comment
Share on other sites

Retail_Price should be a NUMERIC column (not VARCHAR), so it will not have the comma in it. Then you can use Retail_Price <= 5000. Using a string-type field for numeric data will make it virtually impossible to compare: i.e. 120 < 30 when compared as a string.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.