Nov 29, 2004 #1 meeble3 Programmer Joined Nov 8, 2004 Messages 52 Location GB $result = mysql_query("SELECT DISTINCT area FROM pubs where location='VOP' (and renewal > 'CURRENT_DATE') order by county",$db); The above query doesn't work. What is wrong? Thanks James
$result = mysql_query("SELECT DISTINCT area FROM pubs where location='VOP' (and renewal > 'CURRENT_DATE') order by county",$db); The above query doesn't work. What is wrong? Thanks James
Nov 30, 2004 #2 Olavxxx Programmer Joined Sep 21, 2004 Messages 1,134 Location NO How does it not work? Can you run other queries in that code? eg. Are you sure the code is correct? Also, why do you have the AND inside () ? Code: SELECT `area` FROM `pubs` WHERE `location` = 'VOP' AND CURDATE() + 0 <= `renewal` GROUP BY `area` ORDER BY `country` ASC; ps. above code is not tested! I would also recommend you reading up on time and date functions that mysql can offer you: http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html Good luck! Olav Alexander Mjelde http://www.volvo-power.netAdmin & Webmaster Upvote 0 Downvote
How does it not work? Can you run other queries in that code? eg. Are you sure the code is correct? Also, why do you have the AND inside () ? Code: SELECT `area` FROM `pubs` WHERE `location` = 'VOP' AND CURDATE() + 0 <= `renewal` GROUP BY `area` ORDER BY `country` ASC; ps. above code is not tested! I would also recommend you reading up on time and date functions that mysql can offer you: http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html Good luck! Olav Alexander Mjelde http://www.volvo-power.netAdmin & Webmaster
Nov 30, 2004 #3 Olavxxx Programmer Joined Sep 21, 2004 Messages 1,134 Location NO hmm,maybe this one is better: Code: ... AND DATEDIFF(CURTIME() + 0, `yourfield`) >= 1 ... Olav Alexander Mjelde http://www.volvo-power.netAdmin & Webmaster Upvote 0 Downvote
hmm,maybe this one is better: Code: ... AND DATEDIFF(CURTIME() + 0, `yourfield`) >= 1 ... Olav Alexander Mjelde http://www.volvo-power.netAdmin & Webmaster
Nov 30, 2004 Thread starter #4 meeble3 Programmer Joined Nov 8, 2004 Messages 52 Location GB Neither of these work I'm afraid... Upvote 0 Downvote
Nov 30, 2004 #5 ericbrunson Technical User Joined Jan 9, 2004 Messages 2,092 Location US is 'renewal' a date field? Upvote 0 Downvote
Dec 1, 2004 #6 Marker67 Programmer Joined Dec 1, 2004 Messages 3 Location US not knowing the error your getting, could the issue be with the $db? has it been set correctly? Do you even need it? Upvote 0 Downvote
not knowing the error your getting, could the issue be with the $db? has it been set correctly? Do you even need it?