Jump to content

Editing database table rows


Nothadoth

Recommended Posts

I have searched this but for some reason I cannot find out how to do this.

I've managed to script the control panel so that I can add things in. Easy: INSERT INTO

However, could someone tell me how to script it so that I can edit a row?
I mean I can select the row from the database and have the data inside of form fields. But when I click submit, how would I make it so that it will edit and replace the row fields with what is in each of the form fields.

Thanks
Link to comment
https://forums.phpfreaks.com/topic/17789-editing-database-table-rows/
Share on other sites

UPDATE phone_tariffs SET Name = '$name', Tariff = '$tariff', Image = '$image';

BUT if you just did that it woudl up date EVERY record in you database so make sure you use the WHERE cluase if you only want to update certain records.

UPDATE phone_tariffs SET Name = '$name', Tariff = '$tariff', Image = '$image' WHERE Id = '$id'

Will ensure you only update the row(s) where Id = the ste value.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.