0

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 '-userfile WHERE id='642' AND userid='459'' at line 1 This is the code

$query = "SELECT * FROM ue-userfile WHERE id='$imageid' AND userid='$userid'";
	$result = mysql_query($query) or die(mysql_error());

	$row = mysql_fetch_array($result) or die(mysql_error());

		$oldalbum = $row['albumname'];
		//if($oldalbum < 2){$oldalbum = "";}
	//albumname = '$oldalbum' BY
	$result6 = mysql_query("UPDATE ue-userfile SET albumname =$newalbum WHERE id=$imageid")or die(mysql_error()); 
	if($result6){echo "Done!";}else echo "Something went wrong...";
2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by Sorcher
0

That dash is being interpreted as a minus sign. Try wrapping the table name in back quotes:

SELECT * FROM `ue-userfile` WHERE id='$imageid' AND userid='$userid'
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.