Echo your query and ensure that $entry has data in it, otherwise
matching '%%' will match everything as you are getting.

Cheers,
Rob.

samug wrote:
> 
> There's no php.sql, so I'll put it here.
> 
> I'm trying to do a search from mysql database like this:
> 
> if (!$inquiry = mysql_query("select id,link,heading,desc from links where
> heading like '%$entry%' or desc like '%$entry%'
> or keyword like '%$entry%'",$connection)){
>     print "<LI>Search was unsuccesful!";
> }
> else{
>     while ($link = mysql_fetch_row($inquiry)){
>         print "<LI><A HREF=\"" . $link[1];
>         print "\">" . $link[2];
>         print "</A> <I>" . $link[3] . "</I>" ;
>     }
> 
> }
> 
> But everytime I get all the possible entries, even though I'm sure it
> doesn't match.
> 
> Thanks for your answers.
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
.-----------------.
| Robert Cummings |
:-----------------`----------------------------.
| Webdeployer - Chief PHP and Java Programmer  |
:----------------------------------------------:
| Mail  : mailto:robert.cummings@;webmotion.com |
| Phone : (613) 731-4046 x.109                 |
:----------------------------------------------:
| Website : http://www.webmotion.com           |
| Fax     : (613) 260-9545                     |
`----------------------------------------------'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to