owner Posted November 19, 2007 Share Posted November 19, 2007 Hello, I am trying to make a little thing that allows you to edit something that you have previously submitted to be in the database. How do you update a value in the database in a certain row? Right now when I run my script, it submits the updated info into into every row in the database. How do I just make it so it inserts it into row x? (x being some random number that I will have passed to it) Thank you, -Owner Quote Link to comment https://forums.phpfreaks.com/topic/77880-update-query/ Share on other sites More sharing options...
teng84 Posted November 19, 2007 Share Posted November 19, 2007 update tablename set tablefield = value where yourrowID = yourID Quote Link to comment https://forums.phpfreaks.com/topic/77880-update-query/#findComment-394173 Share on other sites More sharing options...
phpSensei Posted November 19, 2007 Share Posted November 19, 2007 <?php $id = // id of the row mysql_query("UPDATE table_name SET coloumn = 'New Value' WHERE colomn_id = '$id'") or die(mysql_error()); ?> Quote Link to comment https://forums.phpfreaks.com/topic/77880-update-query/#findComment-394179 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.