tmp_ Posted March 31, 2010 Share Posted March 31, 2010 I have a forum software I've almost completed, but I need for the admin panel to update a user's entry all at once, I tried something like this: $query = "UPDATE users SET id='$id', username='$nam', password='$pass', email='$email', registerdate='$reg', lastlogin='$log', title='$title', status='$stat' WHERE usernamename = '$user'"; mysql_query($query) or die(mysql_error()); But no matter what I put the table isn't updated. I tried SET id='$id' AND username = '$nam' with all AND's instead of commas, but they don't update the query still, how do I update more than one column at the same time? I can't find anything online that does this Link to comment https://forums.phpfreaks.com/topic/197053-update-with-more-than-one-variable/ Share on other sites More sharing options...
trq Posted March 31, 2010 Share Posted March 31, 2010 What error do you get? password is a function in mysql so you'll need to surround it in backticks. , `password`='$pass', Link to comment https://forums.phpfreaks.com/topic/197053-update-with-more-than-one-variable/#findComment-1034428 Share on other sites More sharing options...
tmp_ Posted March 31, 2010 Author Share Posted March 31, 2010 Alright, thanks! Seemed I also made the form to edit the variables POST to the wrong place, it works fine now. Link to comment https://forums.phpfreaks.com/topic/197053-update-with-more-than-one-variable/#findComment-1034436 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.