Jump to content

Weird MySQL Error.


GB_001

Recommended Posts

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 'WHERE User1='redduck2g@hotmail.com' And User2='email@email.com'' at line 1

 

 

<?php

session_start();

@mysql_connect("mysql.x10hosting.com", "gb_GB", "**********************") or die(mysql_error());

@mysql_select_db("gb_USERInfo") or die(mysql_error());

 

$Friend=$_GET['F'];

$User=$_SESSION['email'];

 

$result = "UPDATE Messages SET Requester='$User' AND Requestee='$Friend' WHERE User1='$User' AND User2='$Friend' OR WHERE User1='$Friend' AND User2='$User'";

 

 

$result2 = mysql_query("SELECT * FROM Messages WHERE User1='$User' AND User2='$Friend'");

$result3 = mysql_query("SELECT * FROM Messages WHERE User2='$Friend' AND User1='$User'");

 

$Num=mysql_num_rows($result2);

$Num1=mysql_num_rows($result3);

 

if($Num==0||$Num1==0){

$query = "INSERT INTO Messages (User1, User2)

VALUES('$User', '$Friend')";

mysql_query($query) or die(mysql_error());

mysql_query($result) or die(mysql_error());

}else{

 

mysql_query($result) or die(mysql_error());

}

 

include("CHAJAX.php?F=$Friend&U=$User");

 

?>

Link to comment
Share on other sites

This line

$result = "UPDATE Messages SET Requester='$User' AND Requestee='$Friend' WHERE User1='$User' AND User2='$Friend' OR WHERE User1='$Friend' AND User2='$User'";

 

should be...

 

$result = "UPDATE Messages SET Requester='$User', Requestee='$Friend' WHERE (User1='$User' AND User2='$Friend') OR (User1='$Friend' AND User2='$User') ";

Link to comment
Share on other sites

Is it possibly you can help me with one more error though?

 

I keep getting this error in the include() part of my code:

 

Warning: include(CHAJAX.php?F=redduck2g@hotmail.com&U=email@email.com) [function.include]: failed to open stream: No such file or directory in /home/gb/public_html/waiting.php on line 28

Link to comment
Share on other sites

Remove the ?F=$Friend&U=$User from

include("CHAJAX.php?F=$Friend&U=$User");

 

And try it... You can't include a file like a url that way... You can only include it via it's file name, meaning no extra parameters.

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.