Video tutorial demonstrates updating / editing of data / records from the database table and displaying it on the browser.
First look at these short videos:
Connect to the database
Simple / basic insertion operation
Insertion of Records into Database using Forms: PHP & MySQL (important)
SELECT / LIST Records From Database Table: PHP & MySQL
Page Contents
Source Code: SELECTING and Displaying Data
index.php
List of companies ..
< ?php while( $row = mysql_fetch_array($res) ) echo "$row[id]. $row[name] edit"; ?>
Video Tutorial: UPDATE / EDIT Records In Database Table: PHP & MySQL
Source Code: Updating / Editing Data / Records In The Database Table
edit.php
"; } ?>
meta tag used to redirect to other page..
MySQL Query
mysql> UPDATE apple SET name='newName' WHERE id='session_id';
Security Issue:
Make sure not to allow people to explicitly pass random id’s and retrieve and edit/update other’s data. To solve this issue, you can save the id of the logged in user in a session variable and instead of passing id to edit.php we can directly use the id stored in our session variable.
This would solve the issue.
Output: After Updating the records:
- Google USA
- Apple USA
- Microsoft USA
- Oracle USA
- Technotip IN
Video’s To Watch:
GET method in action
Post method in action
session variable basics
User login and session