FURQAN Posted June 7, 2010 Share Posted June 7, 2010 hi there furqi here i have a problem of mysql in my code following is the code any help will b highly appreciated thanxxx <?php mysql_connect('localhost','root','') or die("cannot run"); mysql_select_db('normalisation') or die("cannot run"); $sql="SELECT a.id,t.correct FROM answertable a,table t WHERE a.rollnumber=t.rollno"; $result=mysql_query($sql) or die("cannot run"); ?> this code gives output "cannot run" i.e., die Link to comment https://forums.phpfreaks.com/topic/204079-query-problem/ Share on other sites More sharing options...
fenway Posted June 7, 2010 Share Posted June 7, 2010 How about dumping mysql_error()? Link to comment https://forums.phpfreaks.com/topic/204079-query-problem/#findComment-1068926 Share on other sites More sharing options...
ignace Posted June 7, 2010 Share Posted June 7, 2010 $result=mysql_query($sql) or die("cannot run " . mysql_error()); Link to comment https://forums.phpfreaks.com/topic/204079-query-problem/#findComment-1068929 Share on other sites More sharing options...
FURQAN Posted June 8, 2010 Author Share Posted June 8, 2010 it is saying the following 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 'table t WHERE a.rollnumber=t.rollno' at line 2 thanxxx Link to comment https://forums.phpfreaks.com/topic/204079-query-problem/#findComment-1069324 Share on other sites More sharing options...
fenway Posted June 8, 2010 Share Posted June 8, 2010 You called your table "table"? Bad idea -- don't use a reserved keyword. Link to comment https://forums.phpfreaks.com/topic/204079-query-problem/#findComment-1069564 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.