> >> SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 
> >> 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 
> >> 'status' = 'active';

Longshot but try to remove the ' ' from around the field names in the
where statement..

Or 

SELECT * FROM My_Table
WHERE field_1 like '%$keyword%' && status = 'active'
|| field_2 like '%$keyword%' && status = 'active'
|| field_3 like '%$keyword%' && status = 'active'

Jeff

> -----Original Message-----
> From: Brian Dunning [mailto:[EMAIL PROTECTED] 
> Sent: Friday, April 23, 2004 11:30 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] OK SQL experts...
> 
> 
> It gives the same error when I run it in phpmyadmin.
> 
> 
> On Apr 23, 2004, at 8:34 AM, Edward Peloke wrote:
> 
> > does it just return the error when running in the php page?  If you
> > pull it
> > out can you run it in mysql without errors?
> >
> > -----Original Message-----
> > From: Brian Dunning [mailto:[EMAIL PROTECTED]
> > Sent: Friday, April 23, 2004 11:23 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP] OK SQL experts...
> >
> >
> > I tried it both ways - didn't make any difference 
> (phpmyadmin adds the 
> > single quotes when I was trying to use its sql function to 
> debug, so I 
> > figured what the hell)...
> >
> >
> > On Apr 23, 2004, at 8:27 AM, Edward Peloke wrote:
> >
> >> why are the table and field names surrounded by single quotes?
> >>
> >> -----Original Message-----
> >> From: Brian Dunning [mailto:[EMAIL PROTECTED]
> >> Sent: Friday, April 23, 2004 11:19 AM
> >> To: [EMAIL PROTECTED]
> >> Subject: [PHP] OK SQL experts...
> >>
> >>
> >> I STFW and RTFM and I still can't figure out why this 
> returns a 1064 
> >> parse error:
> >>
> >> SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 
> >> 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 
> >> 'status' = 'active';
> >>
> >> Anyone? TIA!
> >>
> >> - B1ff Lamer
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >>
> > - Brian
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> - Brian
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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

Reply via email to