07 PHP MYSQL Update Delete

of 14

  • date post

    30-May-2018
  • Category

    Documents

  • view

    220
  • download

    0

Embed Size (px)

Transcript of 07 PHP MYSQL Update Delete

  • 8/14/2019 07 PHP MYSQL Update Delete

    1/14

    GeshanManandhar.comGeshanManandhar.com 11

    PHP Day 07PHP Day 07

    Geshan ManandharGeshan ManandharDeveloper,Developer, Young Innovations Private Limited Young Innovations Private Limited

    www.geshanmanandhar.comwww.geshanmanandhar.com

    http://www.php.net http://www.mysql.com

    http://www.php.net/http://www.mysql.com/http://www.mysql.com/http://www.php.net/
  • 8/14/2019 07 PHP MYSQL Update Delete

    2/14

    GeshanManandhar.com 2

    List Users with actions (detail,List Users with actions (detail,edit, delete)edit, delete)

  • 8/14/2019 07 PHP MYSQL Update Delete

    3/14

  • 8/14/2019 07 PHP MYSQL Update Delete

    4/14

  • 8/14/2019 07 PHP MYSQL Update Delete

    5/14

    GeshanManandhar.com 5

    Show user table constructionShow user table constructioncodecode

  • 8/14/2019 07 PHP MYSQL Update Delete

    6/14

    GeshanManandhar.com 6

    Output of user_detail.php?Output of user_detail.php?id=Xid=X

  • 8/14/2019 07 PHP MYSQL Update Delete

    7/14

    GeshanManandhar.com 7

    Update User.Update User. Form is a combination of Form is a combination of

    prog46_user_reg.php and user_detail.php.prog46_user_reg.php and user_detail.php. user_edit.php is a form with values of theuser_edit.php is a form with values of the

    user_id passed via the URL.user_id passed via the URL. Check out the code at day07\user_edit.phpCheck out the code at day07\user_edit.php It also needs a variable called id to be passedIt also needs a variable called id to be passed

    vai the URL making the URL look somethingvai the URL making the URL look somethinglike:like: http://localhost/php_class/day07/user_edit.php?id=5http://localhost/php_class/day07/user_edit.php?id=5

  • 8/14/2019 07 PHP MYSQL Update Delete

    8/14

    GeshanManandhar.com 8

    Output of User Update formOutput of User Update form

  • 8/14/2019 07 PHP MYSQL Update Delete

    9/14

    GeshanManandhar.com 9

    Edit user the functionEdit user the function

  • 8/14/2019 07 PHP MYSQL Update Delete

    10/14

    GeshanManandhar.com 10

    Delete UserDelete User In every delete call always confirm theIn every delete call always confirm the

    delete operation, preferably withdelete operation, preferably with javascript. javascript.

    Similar to user_detail but this operationSimilar to user_detail but this operationdeletes the record from the database.deletes the record from the database.

    Usage of parameter via URL and fetchedUsage of parameter via URL and fetched

    in $_GET variable.in $_GET variable. Full code at: day07\user_delete.phpFull code at: day07\user_delete.php

  • 8/14/2019 07 PHP MYSQL Update Delete

    11/14

    GeshanManandhar.com 11

    Delete user function codeDelete user function code

  • 8/14/2019 07 PHP MYSQL Update Delete

    12/14

    GeshanManandhar.com 12

    CRUD doneCRUD done

    That sums up the regular Create Read That sums up the regular Create ReadUpdate Delete (CRUD) operations.Update Delete (CRUD) operations.

    The common and most used operation The common and most used operationin any database focused application.in any database focused application.

    Other things like search, sorting etcOther things like search, sorting etcare enhanced form or Read/Retrieve.are enhanced form or Read/Retrieve.

    Things to do: some sorting and join Things to do: some sorting and joinqueries for tables.queries for tables.

  • 8/14/2019 07 PHP MYSQL Update Delete

    13/14

    GeshanManandhar.com 13

    QuestionsQuestions

  • 8/14/2019 07 PHP MYSQL Update Delete

    14/14

    GeshanManandhar.com 14

    AssignmentAssignment Create a user management system withCreate a user management system with

    picture upload, the database only stores thepicture upload, the database only stores thefilename. (keep in mind file should not befilename. (keep in mind file should not be

    over-written in case of same filename).over-written in case of same filename). Let there be option for type of user Admin,Let there be option for type of user Admin,

    Super User or Normal User.Super User or Normal User. Perform CRUD operations on your loginPerform CRUD operations on your login

    system.system.