Re: [PHP] OK SQL experts...

2004-04-25 Thread Daniel Clark
I think you want to remove the single quotes around the field names. SELECT * FROM my_table WHERE (field_1 LIKE '%$keyword%' OR field_2 LIKE '%$keyword%' OR field_3 LIKE '%$keyword%') AND status = 'active'; I STFW and RTFM and I still can't figure out why this returns a 1064 parse error:

Re: [PHP] OK SQL experts...

2004-04-25 Thread Daniel Clark
The parenthesis are OK. The query might take a long time to run with 3 LIKE statements. Backticks, single quotes, or nothing at all makes no difference. I believe the parsing error is due to my parentheses or AND/OR structure. Any thoughts on that? On Apr 23, 2004, at 8:32 AM, John W.

[PHP] OK SQL experts...

2004-04-23 Thread Brian Dunning
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

RE: [PHP] OK SQL experts...

2004-04-23 Thread Edward Peloke
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

Re: [PHP] OK SQL experts...

2004-04-23 Thread Brian Dunning
? -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

RE: [PHP] OK SQL experts...

2004-04-23 Thread Jay Blanchard
[snip] 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)... [/snip] Those aren't single quotes it adds to table and column names...those are back tics (on the same key as the

RE: [PHP] OK SQL experts...

2004-04-23 Thread Edward Peloke
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

Re: [PHP] OK SQL experts...

2004-04-23 Thread Brian Dunning
] 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

Re: [PHP] OK SQL experts...

2004-04-23 Thread Richard Harb
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

Re: [PHP] OK SQL experts...

2004-04-23 Thread John W. Holmes
From: Brian Dunning [EMAIL PROTECTED] 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'; Use backticks

Re: [PHP] OK SQL experts...

2004-04-23 Thread Brian Dunning
Backticks, single quotes, or nothing at all makes no difference. I believe the parsing error is due to my parentheses or AND/OR structure. Any thoughts on that? On Apr 23, 2004, at 8:32 AM, John W. Holmes wrote: From: Brian Dunning [EMAIL PROTECTED] I STFW and RTFM and I still can't figure

RE: [PHP] OK SQL experts...

2004-04-23 Thread Jeff McKeon
[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

RE: [PHP] OK SQL experts...

2004-04-23 Thread Jay Blanchard
[snip] SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 'status' = 'active'; [/snip] How about this? SELECT * FROM my_table WHERE (field_1 LIKE '%$keyword%' OR field_2 LIKE '%$keyword%' OR field_3 LIKE '%$keyword%')

RE: [PHP] OK SQL experts...

2004-04-23 Thread Edward Peloke
what value is being put in the $keyword variable? You are sure all these columns exist? -Original Message- From: Brian Dunning [mailto:[EMAIL PROTECTED] Sent: Friday, April 23, 2004 11:36 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] OK SQL experts... Backticks, single quotes, or nothing

RE: [PHP] OK SQL experts...

2004-04-23 Thread Edward Peloke
if you echo out the query..what is the output? -Original Message- From: Brian Dunning [mailto:[EMAIL PROTECTED] Sent: Friday, April 23, 2004 11:36 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] OK SQL experts... Backticks, single quotes, or nothing at all makes no difference. I believe

Re: [PHP] OK SQL experts...

2004-04-23 Thread Brian Dunning
Message- From: Brian Dunning [mailto:[EMAIL PROTECTED] Sent: Friday, April 23, 2004 11:36 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] OK SQL experts... Backticks, single quotes, or nothing at all makes no difference. I believe the parsing error is due to my parentheses or AND/OR structure. Any

Re: [PHP] OK SQL experts...

2004-04-23 Thread Brian Dunning
PROTECTED] Subject: Re: [PHP] OK SQL experts... Backticks, single quotes, or nothing at all makes no difference. I believe the parsing error is due to my parentheses or AND/OR structure. Any thoughts on that? On Apr 23, 2004, at 8:32 AM, John W. Holmes wrote: From: Brian Dunning [EMAIL PROTECTED

Re: [PHP] OK SQL experts...

2004-04-23 Thread Mark
[mailto:[EMAIL PROTECTED] Sent: Friday, April 23, 2004 11:36 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] OK SQL experts... Backticks, single quotes, or nothing at all makes no difference. I believe the parsing error is due to my parentheses or AND/OR structure. Any thoughts

RE: [PHP] OK SQL experts...

2004-04-23 Thread Daniel Purdy
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'; Why don't you try rebuilding the query. I mean go into

RE: [PHP] OK SQL experts...

2004-04-23 Thread Jay Blanchard
[snip] SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 'status' = 'active'; [/snip] *slaps forehead* SELECT * FROM my_table WHERE (field_1 LIKE '% . $keyword . %' OR field_2 LIKE '% . $keyword . %' OR field_3 LIKE

Re: [PHP] OK SQL experts...

2004-04-23 Thread Brian Dunning
? You are sure all these columns exist? -Original Message- From: Brian Dunning [mailto:[EMAIL PROTECTED] Sent: Friday, April 23, 2004 11:36 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] OK SQL experts... Backticks, single quotes, or nothing at all makes no difference. I believe the parsing

RE: [PHP] OK SQL experts...

2004-04-23 Thread Chris W. Parker
Brian Dunning mailto:[EMAIL PROTECTED] on Friday, April 23, 2004 8:19 AM said: SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 'status' = 'active'; have you tried simply: SELECT * FROM my_table WHERE status =

RE: [PHP] OK SQL experts...

2004-04-23 Thread Jay Blanchard
[snip] SELECT * FROM my_table WHERE (field_1 LIKE '%$keyword%') AND status = 'active'; if that works continue until you get an error. [/snip] That'll give you an error right there. That old single quoted variable will get you every time. :) WHERE (field_1 LIKE '%$keyword%') WHERE (field_1

Re[2]: [PHP] OK SQL experts...

2004-04-23 Thread Tom Rogers
Hi, Saturday, April 24, 2004, 1:55:36 AM, you wrote: JB [snip] JB SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR JB 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND JB 'status' = 'active'; JB [/snip] JB *slaps forehead* JB SELECT * FROM my_table WHERE (field_1

Re: [PHP] OK SQL experts...

2004-04-23 Thread Brian Dunning
if that works move up into: SELECT * FROM my_table WHERE (field_1 LIKE '%$keyword%') AND status = 'active'; Yes, I actually did exactly that. Everything works until I have more than one statement inside the (x LIKE x OR x LIKE x) parens. That's why I figured there has to be something wrong with

RE: Re[2]: [PHP] OK SQL experts...

2004-04-23 Thread Jay Blanchard
[snip] They do if they are themselves inside double quotes :) echo '$var'; will get parsed ok [/snip] I know, but since I saw no double quotes I had to go for the obvious. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re[4]: [PHP] OK SQL experts...

2004-04-23 Thread Tom Rogers
Hi, Saturday, April 24, 2004, 2:03:36 AM, you wrote: JB [snip] JB They do if they are themselves inside double quotes :) JB echo '$var'; will get parsed ok JB [/snip] JB I know, but since I saw no double quotes I had to go for the obvious. :) Yes I would like to see the whole truth as well :)

Re[2]: [PHP] OK SQL experts...

2004-04-23 Thread Richard Davey
Hello Brian, Friday, April 23, 2004, 5:02:00 PM, you wrote: BD Yes, I actually did exactly that. Everything works until I have more BD than one statement inside the (x LIKE x OR x LIKE x) parens. That's why BD I figured there has to be something wrong with my paren structure. When BD I RTFM I

Re: [PHP] OK SQL experts...

2004-04-23 Thread William Lovaton
How are you manipulating the whole SQL string?? $sql = SELECT...; ??? or $sql = 'SELECT...'; ??? In this case you will have to use double quotes because PHP won't parse single quote strings for searching embedded PHP variables. May be this is the problem. -William El vie, 23-04-2004 a

Re: [PHP] OK SQL experts...

2004-04-23 Thread Curt Zirzow
* Thus wrote Brian Dunning ([EMAIL PROTECTED]): 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'; You might

Re: [PHP] OK SQL experts...

2004-04-23 Thread John Nichel
Brian Dunning wrote: 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 What does

Re: [PHP] OK SQL experts...

2004-04-23 Thread Brian Dunning
On Apr 23, 2004, at 10:13 AM, John Nichel wrote: Brian Dunning wrote: 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' =

RE: [PHP] OK SQL experts...

2004-04-23 Thread Edward Peloke
doesn't look like your $keyword value contains anything. -Original Message- From: Brian Dunning [mailto:[EMAIL PROTECTED] Sent: Friday, April 23, 2004 1:19 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] OK SQL experts... On Apr 23, 2004, at 10:13 AM, John Nichel wrote: Brian Dunning

Re: [PHP] OK SQL experts...

2004-04-23 Thread Brian Dunning
On Apr 23, 2004, at 10:27 AM, Edward Peloke wrote: doesn't look like your $keyword value contains anything. My error. Here is the actual return: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ''my_table'

Re: [PHP] OK SQL experts...

2004-04-23 Thread Curt Zirzow
* Thus wrote Brian Dunning ([EMAIL PROTECTED]): On Apr 23, 2004, at 10:13 AM, John Nichel wrote: Brian Dunning wrote: 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

Re[2]: [PHP] OK SQL experts...

2004-04-23 Thread Richard Davey
Hello Brian, Friday, April 23, 2004, 6:18:43 PM, you wrote: BD You have an error in your SQL syntax. Check the manual that corresponds BD to your MySQL server version for the right syntax to use near BD ''my_table' WHERE ('field_1' LIKE '%%' OR 'field2' my_table should NOT be quoted in this

Re: [PHP] OK SQL experts...

2004-04-23 Thread Brian Dunning
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ''my_table' WHERE ('field_1' LIKE '%%' OR 'field2' Because you are using a single quotes around your table/field names. Remove them or use ` (back tick). As

Re: [PHP] OK SQL experts...

2004-04-23 Thread John W. Holmes
From: Brian Dunning [EMAIL PROTECTED] My error. Here is the actual return: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ''my_table' WHERE ('field_1' LIKE '%custom%' OR 'field_ I am searching for the

Re: [PHP] OK SQL experts...

2004-04-23 Thread Brian Dunning
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ''my_table' WHERE ('field_1' LIKE '%%' OR 'field2' Because you are using a single quotes around your table/field names. Remove them or use ` (back tick). As

Re: [PHP] OK SQL experts...

2004-04-23 Thread John Nichel
Brian Dunning wrote: On Apr 23, 2004, at 10:13 AM, John Nichel wrote: Brian Dunning wrote: 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