PHP - Update Records In MYSQL Database Using PHP

Поділитися
Вставка
  • Опубліковано 19 вер 2024
  • Update Records In MYSQL Database Using PHP
    In this tutorial I created one index.php to display all the records.
    For each record i have created different form. Each form has one hidden field for primary key, Iave also added Update button to each form when we click on the update button of particular records the ID and new values of that records is send to the update.php page via POST method. Second Page I created update.php,this page contains php script to update the records in mysql.
    This video is for learning PHP and develop websites using PHP and MYSQL. The aim is to teach the Web Designing/Development in a step-by-step guided approach.
    Intro Track By : Danish Shaikh
    ~-~~-~~~-~~-~
    Please watch: "Registration Form In PHP adn MYSQL"
    • Registration Form In P...
    ~-~~-~~~-~~-~

КОМЕНТАРІ • 142

  • @suryadi_office
    @suryadi_office 2 роки тому +1

    great friend, success always

  • @yossihorev3250
    @yossihorev3250 6 років тому +5

    Thank you so much ! I needed this tutorial desperately !

  • @GenghisD0ng
    @GenghisD0ng 6 років тому +2

    Thank you! I had to search so long for this

  • @sahanaakter2811
    @sahanaakter2811 7 років тому +1

    Thanks for nice tutorial for us .I want to say Really nice tutorial .I have got it Today.Now I am felling so well.That's why i am commenting This site.Due to It helped a lot of.At last I Will wait next tutorial

  • @KusakaStudio
    @KusakaStudio 4 роки тому +3

    Thanks for your tutorial, it was really helpful for me :).

  • @DIAP2001
    @DIAP2001 7 років тому +1

    Excellent explanation. Short and clear. I was very useful for my. Thank you!

  • @cerealkiller1889
    @cerealkiller1889 6 років тому

    Excellent Tutorial. Keep it up! More php tutorials coming.

  • @globalentertainment3169
    @globalentertainment3169 7 років тому +2

    Done perfectly, thank you

  • @mraziz3230
    @mraziz3230 4 роки тому

    Thank you, i learnd how to make edit and delete by your videos. Thank you so much. :)

  • @patrickbroaden9820
    @patrickbroaden9820 3 роки тому +2

    Great video...💪🏾

  • @akshaykhairnar1747
    @akshaykhairnar1747 6 років тому +1

    you are great bro.... thank u so much........

  • @mariadebbah1759
    @mariadebbah1759 6 років тому

    Thankyou sooooo much you have helped me a lot , BARAKA ALLAHO FIKA

  • @khalidQweder
    @khalidQweder 7 років тому +2

    Good Tutorial, Thank you.

  • @paragkulkarni9770
    @paragkulkarni9770 6 років тому

    Very helpful video. Thanks a lot.

  • @computerlearning2322
    @computerlearning2322 3 роки тому +1

    Excellent explanation. Short and clear. I was very useful for my. i very use this video and one agen Thank you! and sir please share link in delete in database video?

  • @shreyas_katagi
    @shreyas_katagi 5 років тому +2

    Good job.👌
    Next time attach the files in the description so that it can be downloaded.

  • @tido7977
    @tido7977 5 років тому +1

    job well done

  • @ritulkumar1211
    @ritulkumar1211 5 років тому

    Thank you, It was very simple and helpful!

  • @HassanAli-xd7jg
    @HassanAli-xd7jg 5 років тому

    Your are the best

  • @mrrono1842
    @mrrono1842 5 років тому +1

    Lot of thanks bro.

  • @inspirationalquotes9469
    @inspirationalquotes9469 4 роки тому +2

    Thank you so much ! I was desperately searching an option for this. My table has lots of records in it. I want it to set the height of the table and use a scroll bar to move up or down. please help.

  • @acetech529
    @acetech529 6 років тому +1

    Thank you very much Boss,

  • @LGOKUL2303
    @LGOKUL2303 4 роки тому +1

    THANK YOU SOOO MUCH!

  • @boniphaceudoya8936
    @boniphaceudoya8936 7 років тому

    Great video thanks I was totally nothing.

  • @charmelainejonathan8540
    @charmelainejonathan8540 8 років тому

    Awesome video... Keep up the great work!!!!

  • @7footballvideos220
    @7footballvideos220 7 років тому +1

    You re KING!

  • @deepukoyickal9186
    @deepukoyickal9186 5 років тому +1

    Thanks bro

  • @idriskoli1380
    @idriskoli1380 7 років тому +1

    good

  • @movax6994
    @movax6994 5 років тому +1

    Thank you!

  • @acetech529
    @acetech529 6 років тому +1

    Great video

  • @yatheeshkrishna376
    @yatheeshkrishna376 6 років тому

    Executed without error thank u:)

  • @mucachobench2628
    @mucachobench2628 5 років тому

    i love you, thanks, this mean a lot for me

  • @ane-manda
    @ane-manda 4 роки тому

    thank you

  • @cedric1015006
    @cedric1015006 6 років тому +1

    Awesome bro

  • @ElegantCoder
    @ElegantCoder 7 років тому +1

    Really good nice job bro....

  • @eastern815
    @eastern815 6 років тому +1

    thanks man

  • @aurelfrancis
    @aurelfrancis 5 років тому +4

    hi i am getting this error
    Parse error: syntax error, unexpected 'update' (T_STRING), expecting ',' or ';' in C:\xampp\htdocs\edit.php on line 44
    please help

  • @wasifzahed
    @wasifzahed 7 років тому

    thanks a lot :)

  • @preetigupta3834
    @preetigupta3834 7 років тому +1

    Video is very nice sir but video is little bit blur. Plz check this part

    • @TheProgrammingGeek
      @TheProgrammingGeek  7 років тому

      +Preeti Gupta
      Sure I will upload future videos in good quality.

  • @tundeo2622
    @tundeo2622 5 років тому

    Nice one!
    However, The execute query for the update.php worked without the curly braces in the if statement.... Interesting

  • @alsahiq.n.4989
    @alsahiq.n.4989 4 роки тому +1

    Thanx, can u explain how to update but one submit

  • @pravinctiwari7160
    @pravinctiwari7160 7 років тому

    Thanks! For Tutorial. I am new on the php and mysql. Just i want to know, if i want to show and update the image then what i need to do?

  • @tejaswiniwalde8257
    @tejaswiniwalde8257 5 років тому +3

    sir,
    these code shows the error i.e. Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in E:\xampp\htdocs\mycode\index.php on line 20

  • @jackngo9338
    @jackngo9338 3 роки тому +1

    What about having just on single update or submit button?

  • @ericfianu6090
    @ericfianu6090 8 років тому +4

    Great video. Helped me a lot. But one thing I want to ask is how can I update only one row or item instead of displaying all bcos if I have a long list it will be inneficient to load all datas. I just need to update one data at a gym. Can u pls pls make a video for that?

    • @TheProgrammingGeek
      @TheProgrammingGeek  8 років тому +1

      +Eric Fianu I will Make the video for Update only one record.

    • @ericfianu6090
      @ericfianu6090 8 років тому

      Will be checking on it. But thanks so much

    • @teenmastr
      @teenmastr 7 років тому +1

      any link to that video??

    • @martinmtandi335
      @martinmtandi335 6 років тому

      need that code too, asap. kindly help please. u can email me the code at mtandimartin@gmail.com

    • @SanjeevBeekeeper
      @SanjeevBeekeeper 6 років тому

      I know its late but if anyone come across your question, this will help.
      In the page where you want to show one record, just add the WHERE tag -
      $sql = "SELECT * FROM your_table_name WHERE ID='$_GET[id]'";

  • @vascofx3475
    @vascofx3475 4 роки тому +1

    I follow step by step , but still not updated :(

  • @Faradars1
    @Faradars1 8 років тому +1

    Hi
    how can i add +1 to the value in my data base?
    for example in salary you have 8000 when i clik the button add +1 to the value to get 8001

  • @ib165
    @ib165 6 років тому

    Good Tutorial. But i want to ask what if we want to save the data to another table

  • @roshnimeravi9163
    @roshnimeravi9163 4 роки тому +1

    thanks for your tutorial, but unable to update the database, pls help

  • @wisdomguy9837
    @wisdomguy9837 Рік тому

    How about if a want to update all records at the same time? If I want it to update all salary of all records with one one click or button? Batch update

  • @sunaish
    @sunaish 8 років тому +1

    Hi I am creating tabular form where user will land on the form after accessing the provided unique link, there on the form he should enter or update the data when he will click on save tab button which will be provided on every tab. Can you please help me with this?, I got success for fetch the data from form and insert into the database but when update form doesn't work.

    • @TheProgrammingGeek
      @TheProgrammingGeek  8 років тому +1

      +sandesh nirulkar Hi Sandesh ,
      I will be happy to help you.
      Can you please provide the complete code , I will try to solve the problem.

    • @sunaish
      @sunaish 8 років тому

      Here is the code:
      Please help me with this

  • @maxcohen13
    @maxcohen13 8 років тому +1

    Nice video! What is needed for a confirmation message after an entry has been successfully changed?
    I tried using *echo* "Success!"; but I got an error.

    • @TheProgrammingGeek
      @TheProgrammingGeek  8 років тому

      Can you please give code in which you are getting error. Post that code in this comment or Fell free to contact on mohd.asim4sk@gmail.com

    • @maxcohen13
      @maxcohen13 8 років тому +1

      +The Programming Geek
      I guess I do not know where to put a confirmation message. I thought of this (in the update.php):
      if (mysqli_query($con,$sql))
      header ("refresh:1; url=index.php; echo 'Success';");
      This did not work. Perhaps the echo statement would go in brackets? I'm not sure.

    • @TheProgrammingGeek
      @TheProgrammingGeek  8 років тому +2

      +maxcohen13
      Try This one:-
      if(mysqli_query($con,$sql))
      {
      echo"Success";
      header("refresh:1; url=index.php");
      }

    • @maxcohen13
      @maxcohen13 8 років тому

      Ah, brackets. I will try. Thank you!

    • @TheProgrammingGeek
      @TheProgrammingGeek  8 років тому

      +maxcohen13
      Does that code solved your problem.
      Put echo tag before the header function if you put echo after header the page will be redirected before showing success. And also don't use echo inside header.

  • @milesjoshualubay3328
    @milesjoshualubay3328 3 роки тому +1

    I already copy your codes to update my database but my database is not updating

  • @LetsRepaintIt
    @LetsRepaintIt 7 років тому

    Hi, I'd like to ask you to make a video. I made a database with all 3 different columns in it and about 600 rows. I made a query to filter the rows. I want the first column and second column to be read only and in the third column there should appear a checkbox. The query shows ~30 rows each time, I want to be able to tick all third columns from each row and then update them all at once with one button. If you got time, please tell me how by making a video. Thanks in advance!

  • @eeoonn_
    @eeoonn_ 7 років тому

    I have an error with the update syntax. It says "Notice: Array to string conversion in C:\xampp\htdocs\studfolio\update_prof.php on line 7"
    Here's the code:
    $sql = "UPDATE users SET fname='$_POST[fname]', mname='$_POST[mname]', lname='$_POST'[lname] where empID = '$_POST[empID]'";

  • @ISOnepal
    @ISOnepal 4 роки тому

    Can we update mutiple rows in single submit button rather than updating one by one ?

  • @lledos6639
    @lledos6639 7 років тому

    How would you use just one button to update them all rather than having to click a separate button for each row?

  • @rw7799
    @rw7799 6 років тому

    how do you update a form but if user leaves say a password field blank it doesnt update the db with a blank value and leaves the value alone in the database. i.e a password that isnt displayed to user for security reasons but they can update the password.

  • @hanselbugwat7817
    @hanselbugwat7817 6 років тому +1

    Hello, i am having a problem with my update, it says successfully update but no update happening in the database, please help!

    • @TheProgrammingGeek
      @TheProgrammingGeek  6 років тому

      Can You Please Share your code ? , I happy to help you ,
      Asim
      From
      The Programming Geek

    • @hanselbugwat7817
      @hanselbugwat7817 6 років тому +1

      should i post it here Aslim?

    • @TheProgrammingGeek
      @TheProgrammingGeek  6 років тому

      Yes, You can post it here.
      Or you can email me at mohd.asim4sk@gmail.com
      Thanks,
      Asim
      From
      The Programming Geek

    • @roshnimeravi9163
      @roshnimeravi9163 4 роки тому

      @@TheProgrammingGeek i also tried this nd i m also facing the same problem pls tell how to resolve it

  • @sarag7218
    @sarag7218 6 років тому

    Sorry, I don't speak english very well. I have a question, when i press the button, the input type don't update. I don't know why, it dosent' say error but it don't update

  • @spiritfinger1477
    @spiritfinger1477 2 роки тому

    Sir if I want to update file photo, how to update? because in update.php I adding before update like this
    $photo_tmp = $_FILES[photo][tmp_name];
    $photo = $_FILES[photo][name];

    $sql = "UPDATE data_users SET photo = $photo , alumni= '$_POST[alumni]' WHERE username= '$_POST[id]'";
    getting error

  • @kashishbehl1617
    @kashishbehl1617 7 років тому

    What if we have to update data of only one user how will we do that because in this code all the users are displayed at the same time.

  • @asimtoppo5170
    @asimtoppo5170 7 років тому +1

    can u make loan update video as you make it

    • @TheProgrammingGeek
      @TheProgrammingGeek  7 років тому +1

      +Asim toppo
      I am happy to help you, Can you please describe which tutorial you want ? I will make it for you.

    • @visha8621
      @visha8621 7 років тому

      Hii,
      I need a complete form with checkboxes, textfield etc, when submitted from front end, it should go to backend, where the admin is able to edit, archive and search for the form. The submitted form should be in table.
      My project is about a form. If information is submitted correctly, it should go to archive..
      plzzzz help, if u have any references :( if possible make the video soon before 13 March. Thanks

  • @punkybirdster4651
    @punkybirdster4651 6 років тому

    i cant update a DATE column. it throws an index error message

  • @aishastips871
    @aishastips871 7 років тому

    error shown in update query
    Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING)

  • @gpravn
    @gpravn 7 років тому

    sir my version 5.5.38 which is supported mysql or mysqli.can u tell me please

    • @TheProgrammingGeek
      @TheProgrammingGeek  7 років тому

      +pravn gundeti
      PHP 5.5.38 supports MySQLi
      From PHP 5.5 MySQL is Deprecated, you have to use MySQLi or you can use PDO_MySQL.

  • @Saezvg
    @Saezvg 6 років тому

    Parse error: syntax error, unexpected 'header' (T_STRING) in C:\xampp\htdocs\popv2\scripts\update.php
    help

  • @someshsahu236
    @someshsahu236 6 років тому

    hi can you please help me in creating registration system that automatically generates id ??

  • @othabesttvdjcoleman218
    @othabesttvdjcoleman218 4 роки тому

    Thamkyou but how can you find the total salary and install in the data base

  • @pranalibejelwar9667
    @pranalibejelwar9667 5 років тому

    hi ,if i want to send one person's salary to other then how to do that ?

  • @syamilfuad5098
    @syamilfuad5098 7 років тому +1

    i have a problem. it keeps saying UNDEFINED INDEX at the update.php How do i fix this?

    • @TheProgrammingGeek
      @TheProgrammingGeek  7 років тому

      +Syamil Fuad
      Hi Syamil Fuad
      Can you please provide your PHP Code.

    • @syamilfuad5098
      @syamilfuad5098 7 років тому

      +The Programming Geek yes do i provide it here?

    • @syamilfuad5098
      @syamilfuad5098 7 років тому

      The Programming Geek i have two fies .php 1st one is for the index purpose, i named it admin_registrar_pending.php. 2nd is admin_registar_update.php which is the problem file

    • @syamilfuad5098
      @syamilfuad5098 7 років тому

      1st file codes:
      admin registrar student
      .active {
      background-color: #4CAF50;
      }

      Profile
      Guideline
      Apply
      Official receipt
      EPF withdrawal letter
      Confirmation letter

      Status
      Logout
      PENDING STATUS LIST

    • @syamilfuad5098
      @syamilfuad5098 7 років тому

      2nd file codes:

  • @arlanariola9502
    @arlanariola9502 6 років тому

    can it be use on php version 5?

  • @tanishaagnihotri4954
    @tanishaagnihotri4954 4 роки тому

    Sir mere program me error nhii aa rahi h but update bhi nhii ho raha h plzz help me

  • @ryklin1
    @ryklin1 5 років тому

    How come you don't call mysql_close() ?

  • @OneAnOnlyRishi
    @OneAnOnlyRishi 7 років тому +1

    Im getting an error with my update query.
    $sql = "UPDATE library SET ISBN='$_POST[ISBN]', Author='$_POST[Author]',Title='$_POST[Title]',Year='$_POST[Year]', WHERE Book_id='$_POST[id] ' ";

    • @TheProgrammingGeek
      @TheProgrammingGeek  7 років тому

      +Guru101
      What error is shown , please paste that error.

    • @chamberecho3552
      @chamberecho3552 7 років тому

      yeah dude! 4 out 5 tutorials end up in an error. this is seen as easy and in a pain in the ass

    • @fitzgay4647
      @fitzgay4647 7 років тому

      remove the colon( , ) after [ Year]'

  • @nagasupreeth2400
    @nagasupreeth2400 6 років тому

    Tysm sir please send me the code please

  • @imranthaim9203
    @imranthaim9203 7 років тому

    database ko select kese karte hai

  • @csandreas1
    @csandreas1 6 років тому

    Welcome to spaghetti code

  • @MuhammadAli-zg2nw
    @MuhammadAli-zg2nw 4 роки тому

    for form of type='submit', you dont have name. Dont know how is it working for u

  • @haarishk2302
    @haarishk2302 7 років тому

    how to reduce the value by updating

  • @bde5692
    @bde5692 5 років тому

    Do you have a link to the code?

  • @jenifayasmin9124
    @jenifayasmin9124 7 років тому

    Name Age Salary show the out put in browser

  • @SureshKumar-qx6vh
    @SureshKumar-qx6vh 3 роки тому

    Pls tutorial in hindi

  • @priyankabhagat4335
    @priyankabhagat4335 5 років тому

    sir code error dera echo (T_ECho)

  • @liyah33
    @liyah33 7 років тому

    does anyone have source code for this?

  • @maryomam920
    @maryomam920 Рік тому

    can anyone send the code? I have an assignment in less than hour :(

  • @liyah33
    @liyah33 7 років тому

    help me????

  • @the3gamingstars837
    @the3gamingstars837 7 років тому

    source code?

  • @imranthaim9203
    @imranthaim9203 7 років тому

    sir aapka whatsapp no. kiya hai

  • @Sachinsharma-zl2kh
    @Sachinsharma-zl2kh 5 років тому

    thoda aache se Btao bhai

  • @dedsecy
    @dedsecy 4 роки тому +1

    Dislike for no source code

  • @alllateststatusvideo218
    @alllateststatusvideo218 6 років тому

    bhai kyu farji video dal kr logo ko bewkuf ban rha hai aur IT walo ka insult kra raha hai bhai

  • @globalentertainment3169
    @globalentertainment3169 7 років тому +1

    Done perfectly, thank you

  • @inushansari5655
    @inushansari5655 6 років тому +1

    Thank You

  • @hiaQadeer
    @hiaQadeer 7 років тому +1

    Thank you ~