runei Posted September 19, 2008 Share Posted September 19, 2008 Here is my index.php. It works like a charm Though I have a MAJOR problem. It wont run anymore and i get this sql 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...?????? What? Where do I even start? Server version. Im using wamp 2.0. I dont know what to do. can anyone help or suggestions would much appreciated runei :'( <?php session_start(); include "./global.php"; ?> <html> <head> <title>Content Management System</title> </head> <style type="text/css"> body { background-color:#999999; font-family: Tahoma; } #holder { width: 90%; color:#000000; font-family: Tahoma; border:1px solid #000; padding:10px; } /*'#userInfo { width: 100%; color: #000; font-family: Tahoma; border: 1px solid #CCC; */ } </style> <body> <center> <div id="holder"> <div id="userInfo"> <?php //Checks if session exists and does a query. if($_SESSION['uid']){ $sql = "SELECT id,username FROM `users` WHERE ='".$SESSION['uid']."'"; $res = mysql_query($sql) or die(mysql_error()); //Ending session.. if(mysql_num_rows($res) == 0){ session_destroy(); echo "Please <a href=\"./login.php\">Login</a> to your account or <a href=\"./register.php\">Register</a> new account!\n"; //One session that exists.. }else{ $row = mysql_fetch_assoc($res); echo"Welcome back <a href=\"./index.php?act=profile&id=".$row['id']."\">".$row['username']."</a>!\n"; } }else{ echo "Please <a href=\"./login.php\">Login</a> to your account or <a href=\"./register.php\">Register</a> new account!\n"; } ?> </div> </center> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/124998-solved-mysql-major-issue/ Share on other sites More sharing options...
ratcateme Posted September 19, 2008 Share Posted September 19, 2008 well you start by looking at your sql statement main the two chars in the error try putting a space after the = Scott. Quote Link to comment https://forums.phpfreaks.com/topic/124998-solved-mysql-major-issue/#findComment-645877 Share on other sites More sharing options...
PFMaBiSmAd Posted September 19, 2008 Share Posted September 19, 2008 There is no expression on the left-hand side of the = Quote Link to comment https://forums.phpfreaks.com/topic/124998-solved-mysql-major-issue/#findComment-645880 Share on other sites More sharing options...
Maq Posted September 19, 2008 Share Posted September 19, 2008 $sql = "SELECT id,username FROM `users` WHERE ='".$SESSION['uid']."'"; See something missing? After WHERE you have a variable. You need to compare $SESSION['uid'] with something... WHERE field_user = '".$SESSION['uid']."'"; Quote Link to comment https://forums.phpfreaks.com/topic/124998-solved-mysql-major-issue/#findComment-645882 Share on other sites More sharing options...
runei Posted September 19, 2008 Author Share Posted September 19, 2008 Lol, thx. I forgot the id. Rather embarrasing ..Thx a bunch Quote Link to comment https://forums.phpfreaks.com/topic/124998-solved-mysql-major-issue/#findComment-645885 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.