Jump to content

[SOLVED] Mysql - major issue..


runei

Recommended Posts

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>

Link to comment
https://forums.phpfreaks.com/topic/124998-solved-mysql-major-issue/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.