joecooper Posted May 5, 2008 Share Posted May 5, 2008 $query = "UPDATE users SET high = $score WHERE username = $username"; mysql_query($query) or die('Error, query failed'); can someone tell me why this might be failing Link to comment https://forums.phpfreaks.com/topic/104183-solved-mysql-update-query-failng/ Share on other sites More sharing options...
AndyB Posted May 5, 2008 Share Posted May 5, 2008 Try $query = "UPDATE users SET high = '$score' WHERE username = '$username'"; mysql_query($query) or die("Error: ". mysql_error(). " with query ". $query); // helpful err message Link to comment https://forums.phpfreaks.com/topic/104183-solved-mysql-update-query-failng/#findComment-533349 Share on other sites More sharing options...
dooper3 Posted May 5, 2008 Share Posted May 5, 2008 Use quotes: $query = "UPDATE users SET high='$score' WHERE username='$username'"; mysql_query($query) or die('Error, query failed'); Other stuff to do... -check you are connected to the database -check the table columns "high" and "username" exist -check the variables $score and $username actually exist If all else fails, show us the actual error message Link to comment https://forums.phpfreaks.com/topic/104183-solved-mysql-update-query-failng/#findComment-533350 Share on other sites More sharing options...
joecooper Posted May 5, 2008 Author Share Posted May 5, 2008 ah it works thanks Link to comment https://forums.phpfreaks.com/topic/104183-solved-mysql-update-query-failng/#findComment-533352 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.