Jump to content

Search from Checkbox


techker

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
https://forums.phpfreaks.com/topic/282397-search-from-checkbox/
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.

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.