07 Php Mysql Update Delete

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    1 Favorite

    07 Php Mysql Update Delete - Presentation Transcript

    1. PHP Day 07 Geshan Manandhar Developer, Young Innovations Private Limited www.geshanmanandhar.com http://www.php.net http://www.mysql.com
    2. List Users with actions (detail, edit, delete)
    3. How to code the actions column
      • Inside while ($row= mysql_fetch_array($user_records) loop
        • $user_id = $row['user_id'];
      • $user_table .= &quot;<td>&quot;; //line no. 56 – day07show_users_with_actions.php
      • $user_table .= &quot;<a href=&quot;user_detail.php?id=$user_id&quot;>Detail</a> - &quot;;
      • $user_table .= &quot;<a href=&quot;user_edit.php?id=$user_id&quot;>Edit</a> - &quot;;
      • $user_table .= &quot;<a href=&quot;user_delete.php?id=$user_id&quot;&quot;;
      • $user_table .= ' onclick=&quot;javascript:return confirm('Do you really want to delete?');&quot;';
      • $user_table .= &quot;>Delete</a> - &quot;;
      • $user_table .= &quot;</td> &quot;;
    4. User Detail
    5. Show user table construction code
    6. Output of user_detail.php?id=X
    7. Update User.
      • Form is a combination of prog46_user_reg.php and user_detail.php.
      • user_edit.php is a form with values of the user_id passed via the URL.
      • Check out the code at day07user_edit.php
      • It also needs a variable called id to be passed vai the URL making the URL look something like: http://localhost/php_class/day07/user_edit.php?id=5
    8. Output of User Update form
    9. Edit user the function
    10. Delete User
      • In every delete call always confirm the delete operation, preferably with javascript.
      • Similar to user_detail but this operation deletes the record from the database.
      • Usage of parameter via URL and fetched in $_GET variable.
      • Full code at: day07user_delete.php
    11. Delete user function code
    12. CRUD done
      • That sums up the regular Create Read Update Delete (CRUD) operations.
      • The common and most used operation in any database focused application.
      • Other things like search, sorting etc are enhanced form or Read/Retrieve.
      • Things to do: some sorting and join queries for tables.
    13. Questions
    14. Assignment
      • Create a user management system with picture upload, the database only stores the filename. (keep in mind file should not be over-written in case of same filename).
      • Let there be option for type of user “Admin”, “Super User” or “Normal User”.
      • Perform CRUD operations on your login system.

    + Geshan ManandharGeshan Manandhar, 5 months ago

    custom

    1040 views, 1 favs, 1 embeds more stats

    PHP MYSQL update and delete.

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 1040
      • 1039 on SlideShare
      • 1 from embeds
    • Comments 0
    • Favorites 1
    • Downloads 0
    Most viewed embeds
    • 1 views on http://localhost

    more

    All embeds
    • 1 views on http://localhost

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories