Welcome to WebmasterWorld Guest from 50.17.114.227

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Using MySQL sub queries in PHP CLI

     
2:45 pm on Jul 20, 2007 (gmt 0)

Full Member

10+ Year Member

joined:Jan 4, 2006
posts:307
votes: 0


I am using a sub query like the following in a cron file and its throwing a query error.

...eexpiry = (CURDATE() + INTERVAL (SELECT alert2 FROM settings) DAY)...

Does that mean I cant use sub queries in PHP CLI?

Milan

3:03 pm on July 20, 2007 (gmt 0)

Administrator

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 24, 2001
posts:15755
votes: 0


what is the exact error it gives you?

have you tried the query you are trying to run from the command line?

6:26 pm on July 20, 2007 (gmt 0)

Full Member

10+ Year Member

joined:Jan 4, 2006
posts:307
votes: 0


The error shown is:-

#1064 - 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 'SELECT alert2 FROM settings ) DAY )

I cant try it on CLI on server as its a shared hosting environment. I have a testing setup on Windows at my place where i will try it and let you know.

Milan

10:49 pm on July 20, 2007 (gmt 0)

Full Member

10+ Year Member

joined:Jan 4, 2006
posts:307
votes: 0


Oh my host uses MySQL version 4.0.27-standard and sub queries are only supported from 4.1 onwards!

Milan

1:39 pm on July 21, 2007 (gmt 0)

Administrator

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 24, 2001
posts:15755
votes: 0


that would definitely do it