Jump to content

Duplicate entry '' for key 2 - please help!!


bian101

Recommended Posts

Hey guys!

 

I know, I know this problem is EVERYWHERE but i just dont understand! I have a solid knowlage of php but my SQL skills are low, so i dont know too much about Keys and stuff. But my error is: Duplicate entry '' for key 2.

 

The thing that im working on at this section is logging in with facebook. The code that presents my error is:

 

    $sql = "SELECT * FROM users WHERE uid=".$uid;
    $fbid = mysql_query($sql);	
$num_rows = mysql_num_rows($fbid);

if(mysql_num_rows($fbid) < 1) {
	echo "You are not logged in.    ";
	mysql_query("INSERT INTO `users` (`uid`) VALUES ('".$uid."')")
	or die(mysql_error());  

	} else {
	mysql_query("UPDATE users SET logged = '1' WHERE uid=".$uid);
	//mysql_query("UPDATE users SET full_name = $me WHERE uid=".$uid);

	echo "Your Logged in ";
	echo $me['name'];
	?> Continue to <a href="removed "> My Settings </a>. <?			
}

 

Any help is welcome :D

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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