> Hi all,
> It's Monday, it's probably something stupid, but I have poured over this all
> day and cannot find the problem.
> This is a simple search engine based on one table. It is suppose to return
> the results of the search word. Instead it returns ALL records in the mysql
> table. If I type the letter x and there are no words in the table with an x
> I still get all records returned.
> Would someone be kind enough to show me what I have done wrong.
> if($search)
> {
>   $query = "SELECT  iname, quantity, user, price FROM
> {$config["prefix"]}_shop WHERE iname LIKE '%$searchword%' AND price > 0
> ORDER BY price";
>  $ret = mysql_query($query) or die(mysql_error());
>  while($row = mysql_fetch_array($ret))
> {

Try echoing your $query to make sure that you are in fact passing an 
expected vlue for $searchword. If, for whatever reason, $searchword is 
empty you will get all records in the table whose value is >0

You seem to be a newcomer to programming. Any time you have a problem, it 
its always useful to echo the arguments that might have a bearing on the 
result you are expecting.

David Robley
Temporary Kiwi!

Quod subigo farinam

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to