The Error that I am recieving is: 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 '' at line 1 The code that is erroring is: <?php session_start(); include('globals.php'); include('header.php'); include('toplinks.php'); if($_SESSION['uid']){ $sql1 = "SELECT * FROM `dirsubmit_account` WHERE `accid`=".$SESSION['uid'].""; $res1 = mysql_query($sql1) or die(mysql_error()); $row1 = mysql_fetch_assoc($res1); $sql2 = "SELECT * FROM `dirsubmit_directories` WHERE `dirid`=".$res1['accsubmissions'].""; $res2 = mysql_query($sql2) or die(mysql_error()); $row2 = mysql_fetch_assoc($res2); echo "<table width=\"800\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">"; echo "<tr>"; echo "<td valign=\"top\"><iframe src=".$row2['dirurl']." height=\"500\" width=\"650\"></iframe></td>"; echo "<td valign=\"top\" id=\"rightnavinfo\">Info for Submission:<br /></td>"; echo "</tr>"; echo "</table>"; }else{ echo "You must login to complete this action!<br /><br />Please <a href=\"login.php\">click here</a> to login!"; } ?> Code (markup): I only recieve the error after I login .... If i'm not logged in then it goes to the else just fine? Any thought's?
hi, i think problem lies in the $sql2 query statement please put $row1['accsubmissions'] instead of $res1['accsubmissions'] and also try put condition or check $row1['accsubmissions'] is null or not before working on sql2 query
still giving me the same error it was working fine and then just bam started to give me the error. the address is: http://directory.mofiki.com/dirsubmit/index.php I will create an account with login and password both test
once you actually logged in and said continue to directory submission it worked? Ah I see you never clicked on the continue button after logging in .... the login and registration works fine its after you login and try to get to the actual member area that gives the SQL error.
Comment one of the queries out, one or the other is making the error... Then go through it... Ill recode these real quick $sql1 = 'SELECT * FROM dirsubmit_account WHERE accid="' . $SESSION['uid'] . '"'; $res1 = mysql_query($sql1) or die(mysql_error()); $row1 = mysql_fetch_assoc($res1); $sql2 = 'SELECT * FROM dirsubmit_directories WHERE dirid="' . $res1['accsubmissions'] . '"'; $res2 = mysql_query($sql2) or die(mysql_error()); $row2 = mysql_fetch_assoc($res2); Code (markup):