The update statement is used to change the value in a table.
Syntax :
update table_name set column_name1='value1', column_name2='value2', ... where column_name(key)='value';
This tutorial require 2 files.
select.php comes from Select Record tutorial. You will make some modify in this file.
update.php
• select.php
This file comes from Select Record tutorial. In this tutorial, you have to modify something by make a link including with a parameter and target to update.php (GET Method)
Browse "select.php" by go to http://localhost/select.php.
Result : (Links below are NOT real on this page)
ID : 1
Name : Jack
Email : [email protected]
Tel : 12345678 Update<- when you mouse over this. It will show "http://localhost/update.php?id=1" in your browser's status bar.
ID : 2
Name : Joe
Email : [email protected]
Tel : 87654321 Update<- when you mouse over this. It will show "http://localhost/update.php?id=2" in your browser's status bar.
...
The values are the same as ID parameters. When you click on these links, the page will change to update.php.
• update.php
This file will show you how you make a change in your database. Show data record in form fields and update it in only this file.
Test
Browse select.php on your web browser as http://localhost/select.php and click on "Update" link. When URL has change to http://localhost/update.php, change some data that show on text fields and then click on "Submit" button, this page will re-load and go back to http://localhost/select.php.