deansaddigh Posted June 23, 2009 Share Posted June 23, 2009 Hi my code is failing at the if/update query Whats wrong with it. //See wether user allready has avatar in table if ($userid !==NULL) { $query= "UPDATE avatar SET Avatar_path, Avatar_name Where User_id=" .$userid; $result =mysql_query($query, $conn) or die ("unable to perform query"); } And help would be grately appreciated Quote Link to comment https://forums.phpfreaks.com/topic/163332-solved-update-query/ Share on other sites More sharing options...
kickstart Posted June 23, 2009 Share Posted June 23, 2009 Hi What do you want to set Avatar_path and Avatar_name to? All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/163332-solved-update-query/#findComment-861767 Share on other sites More sharing options...
deansaddigh Posted June 23, 2009 Author Share Posted June 23, 2009 Hi and thanks for the reply. I want to set avatar_name and avatar_path to $filename and $path how can this be done? Quote Link to comment https://forums.phpfreaks.com/topic/163332-solved-update-query/#findComment-861821 Share on other sites More sharing options...
kickstart Posted June 23, 2009 Share Posted June 23, 2009 Hi Something like this //See wether user allready has avatar in table if ($userid !==NULL) { $query= "UPDATE avatar SET Avatar_path = '$filename', Avatar_name = '$path' Where User_id=" .$userid; $result =mysql_query($query, $conn) or die ("unable to perform query"); } This assumes that $filename and $path are safe (ie, you have run mysql_real_escape_string() on them). All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/163332-solved-update-query/#findComment-861829 Share on other sites More sharing options...
deansaddigh Posted June 23, 2009 Author Share Posted June 23, 2009 Thank you thats perfect and it works. kind regards Quote Link to comment https://forums.phpfreaks.com/topic/163332-solved-update-query/#findComment-861836 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.