Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/269698-unknown-error/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/269698-unknown-error/#findComment-1386451
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.