Alicia Posted October 19, 2012 Share Posted October 19, 2012 Hi, i am trying to run this script but encounted an unknown error .. can somebody give me an idea whats wrong with my php mysql code $mysett = "'".$myopt[0].','.$myopt[1].','.$myopt[2].','.$myopt[3]."'"; $prescho = mysql_query("SELECT *FROM stud WHERE `d_type_id`IN ($mysett) AND `disp_homep` = 'yes' AND STR_TO_DATE(join, '%d/%m/%Y' ) <= CURDATE( ) AND STR_TO_DATE( left '%d/%m/%Y' ) > CURDATE( ) ORDER BY FIELD( `d_type_id` , $mysett ) , `Deal`.`join` DESC"); no error or record displayed in the page even there are records match the condition... please help Quote Link to comment https://forums.phpfreaks.com/topic/269698-unknown-error/ Share on other sites More sharing options...
Pikachu2000 Posted October 19, 2012 Share Posted October 19, 2012 If you echo $mysett, you'll notice it's in the wrong format for IN syntax. Quote Link to comment https://forums.phpfreaks.com/topic/269698-unknown-error/#findComment-1386450 Share on other sites More sharing options...
ManiacDan Posted October 19, 2012 Share Posted October 19, 2012 Both "join" and "left" are reserved MySQL keywords and must be enclosed in `backticks`. You're also missing a comma after "left" The reason why you're not getting an error is because you're probably not checking the results of your queries and actually displaying errors. MySQL errors must be handled and displayed by your PHP, since SQL is a separate language run on a separate server. Quote Link to comment https://forums.phpfreaks.com/topic/269698-unknown-error/#findComment-1386451 Share on other sites More sharing options...
ManiacDan Posted October 19, 2012 Share Posted October 19, 2012 What Pika said too. There's at least 3 mysql errors in your query. Quote Link to comment https://forums.phpfreaks.com/topic/269698-unknown-error/#findComment-1386452 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.