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...";

Recommended Answers

All 2 Replies

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'

Fixed. thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.