Jump to content

error in sql syntax...line 1


MDanz

Recommended Posts

i get this 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 's',0,'',0)' at line 1

 

i don't see what i've done wrong.

 

 mysql_connect("localhost", "Master", "pword");
mysql_select_db("db");

$id = $_GET['id'];
$keywords = $_GET['search'];

$totalid = $id-1;
$id = mysql_real_escape_string($id)or die (mysql_error()); ## always do this!!!!
   $result = mysql_query("SELECT * FROM Stacks WHERE origin=$totalid and keywords='$keywords'")or die (mysql_error());
   while ($row = mysql_fetch_array($result))
   {
   $name = $row['reply']; 
$image = $row['image'];
}
   $username1 = $_SESSION['username'];
 $ip = $_SERVER['REMOTE_ADDR'];



      $query = "INSERT INTO suscribed";
      $query .= "(`username`,`ip`,`name`,`topicid`,`image`,`origin`) VALUES ('$username1','$ip','$name',$totalid,'$image',$totalid)";
      $results = mysql_query($query)or die (mysql_error());


if($query){ 


print "<br><font color=white>You have suscribed.  <FORM><INPUT TYPE='button' VALUE='Return' onClick='history.go(-1);return
true;'> </FORM>"; }
else {
print "No image selected/uploaded";
}

Link to comment
https://forums.phpfreaks.com/topic/206819-error-in-sql-syntaxline-1/
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.