sql query

Steve Greenshaw steve at softgreen.co.uk
Wed Nov 13 16:07:15 GMT 2002


Hi,

If the id is a number (as I assume it would be) then it should not be
'quoted' ... so:

if ($result = mysql_query("SELECT * FROM db WHERE name LIKE '$name%' OR
id = $id", $db));
{
blah blah blah
}

Steve.


Robin Garbutt wrote:
> 
> can you use 'LIKE' and '=' in the same sql query?
> 
> e.g
> 
> if ($result = mysql_query("SELECT * FROM db WHERE name LIKE '$name%' OR id =
> '$id'", $db));
> {
>     blah blah blah
> }
> 
> as the id don't seem to be querying...
> 
> any suggestions?
> 
> cheers!
> 
> Robin Garbutt
> Portfolio Art & Design Ltd
> Tel -  +44 (0) 1204 383822
> Fax - +44 (0) 1204 383866
> Mob - +44 (0) 7811 185490
> e-mail - Rob at portfoliodesign.net
> 
> For further information please visit us at :-
> www.portfoliodesign.net
> 
> The contents of this e-mail are confidential to the ordinary user of the
> e-mail address to which it was addressed and may also be privileged. If you
> are not the addressee of this e-mail you may not copy, forward, disclose or
> otherwise use it or any part of it in any form whatsoever. If you have
> received this e-mail in error please e-mail the sender.
> 
> ------ FreeBSD UK Users' Group  -  Mailing List ------
> http://listserver.uk.freebsd.org/mailman/listinfo/freebsd-users




More information about the Ukfreebsd mailing list