0

Hi, I'm trying to write a script that allows me to insert a file into MySql. I would like it to work under the user's session. I am getting 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 user_id = 'dck172'(name, content)VALUES('dave.jpg','����\0JFIF\0\0d\0d' at line 1)
Here is the code I am having a problem with:

$colname_Recordset1 = "-1";
if (isset($_SESSION['MM_Username'])) {
  $colname_Recordset1 = $_SESSION['MM_Username'];
}

//include('includes/create_thumb3.inc.php');
	if (!$insert = mysql_query("INSERT INTO mystuff.page WHERE user_id = '$colname_Recordset1'(name, content)VALUES('$content_name','$content')"))
echo (mysql_error());

Any help would be awesome, Thanks

3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by lyrico
0

Try this query

$insert = mysql_query("INSERT INTO mystuff.pageser (name,content) VALUES('$content_name','$content') where user_id = '$colname_Recordset1'"));

Edited by mike_2000_17: Fixed formatting

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.