JohnGato Posted June 11, 2011 Share Posted June 11, 2011 Can anyone help me this error QUERY ERROR: 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 Query was SELECT view FROM users WHERE userid= cant figure it out Thanks for any help Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted June 11, 2011 Share Posted June 11, 2011 Where it happens? What section of code? Quote Link to comment Share on other sites More sharing options...
JohnGato Posted June 11, 2011 Author Share Posted June 11, 2011 Its happening on login when i login to go to the home page....... Quote Link to comment Share on other sites More sharing options...
chicka Posted June 11, 2011 Share Posted June 11, 2011 Its probably because you have 0 users in your database. If you haven't go a single user in the database it will throw that error. I got stuck in that same situation once upon a time... Quote Link to comment Share on other sites More sharing options...
JohnGato Posted June 11, 2011 Author Share Posted June 11, 2011 I have 2 users in the DB Quote Link to comment Share on other sites More sharing options...
W3Theory || Peter Posted June 11, 2011 Share Posted June 11, 2011 You probably should show the code for that area as right now it's like we are in the blind tunnel Quote Link to comment Share on other sites More sharing options...
Uridium Posted June 11, 2011 Share Posted June 11, 2011 if your using mcc try adding global $db; above the SELECT statement usually thats the culprit. Quote Link to comment Share on other sites More sharing options...
bineye Posted June 11, 2011 Share Posted June 11, 2011 or put the bit after like userid={$ir['userid']} or userid=".$ir['userid']." Quote Link to comment Share on other sites More sharing options...
lucky3809 Posted June 11, 2011 Share Posted June 11, 2011 what page is giving the error? find that part SELECT view FROM users WHERE userid= after the = put $userid and remove what is there Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted June 12, 2011 Share Posted June 12, 2011 He said above.... it happens on login. Ive seen this before when the session has ended or not created. Quote Link to comment Share on other sites More sharing options...
JohnGato Posted June 14, 2011 Author Share Posted June 14, 2011 OK got that fixed now im getting this error QUERY ERROR: 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 'AND magColumn='1' AND magVisible='yes'' at line 1 Query was SELECT magID,magLocation,magText FROM newsMagazine WHERE magLocation= AND magColumn='1' AND magVisible='yes' here is the line of code: $rm1=$db->fetch_row($db->query("SELECT magID,magLocation,magText FROM newsMagazine WHERE magLocation={$ir['location']} AND magColumn='1' AND magVisible='yes'")); $rm2=$db->fetch_row($db->query("SELECT magID,magLocation,magText FROM newsMagazine WHERE magLocation={$ir['location']} AND magColumn='2' AND magVisible='yes'")); Thank for any help... really appreciate it Quote Link to comment Share on other sites More sharing options...
bineye Posted June 14, 2011 Share Posted June 14, 2011 The problem is the $ir global hasn't been defined before, hence it returning a blank error. You need to include the globals file, then use global $ir. Quote Link to comment Share on other sites More sharing options...
Uridium Posted June 14, 2011 Share Posted June 14, 2011 John when posting an error try and copy 4 linesd above and 4 lines below the error line so we have a better picture Quote Link to comment Share on other sites More sharing options...
lucky3809 Posted June 15, 2011 Share Posted June 15, 2011 Your error is the end of magLocation= the error... {$ir['location']} As bineye stated you may have not defined it... most likely that is the problem... OR it may be that $ir does not go there at all, what query are you pulling the ['location'] from? it could be you did not add the correct $var... such as this example... $var=query selecting ['location'] $location=$db->fetch_row($var); it would then be $location['location'] instead of $ir... You have not included a lot of info from those very few lines... Quote Link to comment 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.