Это видео недоступно.
Сожалеем об этом.

Prevent Duplicate Record Insertion on browser Refresh mysql | php

Поделиться
HTML-код
  • Опубликовано: 5 июн 2017
  • #phptutorials #phpduplicateinsert #mysqlduplicaterecords
    Prevent Duplicate Record Insertion on browser Refresh mysql | php
    MySQL insert and prevent duplicate records on browser refresh | PHP, implement server-side validation by checking if the submitted data already exists in the database before inserting. Utilize PHP to query the database and verify the data's existence, then execute the insertion only if it's not a duplicate. Employ techniques like checking unique constraints, using SELECT queries, and session-based flags to ensure new records are added while preventing duplicates upon browser refresh.
    How To Connect MySQL (phpmyadmin) and Insert Record In PHP
    To connect MySQL in PHP, use "mysqli_connect" with host, username, password, and database name. Then, prepare an "INSERT" SQL statement with data values. Execute it using "mysqli_query."
    checkout the complete video tutorial ! will explain, the PHP code on avoiding duplicate data insertion values on page reload in MySQL (phpMyAdmin) remote database

Комментарии • 57

  • @computerworld3835
    @computerworld3835 5 лет назад +2

    HI, I'm from Pakistan but i appreciate your work.
    it's not a proper solution but it's very help full for me.
    thanks for the video.

    • @ahmedelmawrdy4381
      @ahmedelmawrdy4381 4 года назад

      then what is the proper one ????!

    • @kmjaseem
      @kmjaseem 4 года назад

      @@ahmedelmawrdy4381 Post/request/get method. to know more, please google it

    • @ahmedelmawrdy4381
      @ahmedelmawrdy4381 4 года назад +1

      @@kmjaseem Thanks a lot

  • @abimaelmacean7108
    @abimaelmacean7108 2 месяца назад +1

    you just act like an angel friend

  • @srinivasaraoyp3640
    @srinivasaraoyp3640 Год назад

    I am new to PHP MYSQL . I was writing a code on how to insert data . Record has been added. Again when I refresh, that old record gets automatically added to the database. That time I have visited your website and saw this demo. I have made the changes , it really worked like a magic with 100% results without any error. Whoever you are , Thank you very much.

  • @zeeshansafdar1760
    @zeeshansafdar1760 6 лет назад +8

    when click on submit button without fill the form then it is also display message your form has submit..It is not exact solution bro

    • @SinghatehAlagie
      @SinghatehAlagie 5 лет назад

      just try and add required in your inputs that will help you

  • @laszlogyor6628
    @laszlogyor6628 2 года назад

    It is a very useful tutorial, thank you for your work. I have already used this solution, perfect.

  • @najambinsajid9462
    @najambinsajid9462 5 лет назад +2

    I have validate the form using php but this was the issue. Now there is another issue that is when I press the submit button show to alert message even all the fields are empty... :(

  • @zahramirzaei2500
    @zahramirzaei2500 Год назад

    your tutorial helped me so much. Many thanks🙏🙏🙏🙏🙏🙏

  • @suryakantupadhayay8979
    @suryakantupadhayay8979 2 года назад

    For me also this code was helpful. Thanks

  • @shashiacharya8803
    @shashiacharya8803 4 года назад

    Thank u so much from few days I am worry about small mistake but you make me to go forward thank bro

  • @sinterklas6984
    @sinterklas6984 3 года назад

    It works! I'm happy. Thank you

  • @SCr_20
    @SCr_20 Год назад

    Thanks man helped a lot!

  • @madhumadhu-tk2eq
    @madhumadhu-tk2eq 2 года назад +1

    Record save two times, how to solve that issues?

  • @stevenneuberger4323
    @stevenneuberger4323 6 лет назад +2

    This would be a better demonstration if mysqli with prepare statements were used. PHP mysql is deprecated and implementing an INSERT in this manner wouldn't handle single quotes in the input, e.g, a last name of O'Connor would cause a nasty error.

    • @bjornwilder2073
      @bjornwilder2073 3 года назад

      I realize Im pretty off topic but does anyone know of a good place to watch new tv shows online?

  • @mohammadabrar7854
    @mohammadabrar7854 Год назад

    Still you can insert duplicate data, you have to write code in php to whether data already exists or not in the database or else it will insert

  • @mahirzebari3646
    @mahirzebari3646 Год назад

    thanks bro that is my problem😍

  • @marineoutsource
    @marineoutsource 4 года назад

    But when you press the back button the same data will be retained and when you click submit, you still have the same records . . . any solution to prevent it?

  • @roxter9963
    @roxter9963 3 года назад

    thank you so much sir!

  • @FreakFolkerify
    @FreakFolkerify 5 лет назад +2

    if ( window.history.replaceState ) {
    window.history.replaceState( null, null, window.location.href );
    }

  • @muddathirmathure
    @muddathirmathure 6 лет назад

    Thank You so Much for this video
    It works perfectly fine for me

  • @excaliburgz1996
    @excaliburgz1996 4 года назад

    Why you used the bolean true in the script function? Im newbie just asking 😁 thanks for kind answers

  • @anurajms
    @anurajms 2 года назад

    thank you

  • @venkateswarammagorantla6323
    @venkateswarammagorantla6323 5 лет назад

    Thank you sir, It helped to me

  • @SunnyIT
    @SunnyIT 4 года назад

    Found helpful.

  • @mohammad-hu4ex
    @mohammad-hu4ex 5 лет назад

    Thank you man ,you saved me

  • @Shanmugarajeshwaran
    @Shanmugarajeshwaran 6 лет назад

    It working. But how to get mysql echo messages after data inserted? Pls help me

  • @emmanuelepiscope4853
    @emmanuelepiscope4853 3 года назад

    thanks

  • @apekshapatel7422
    @apekshapatel7422 4 года назад

    how to remove dublication and not enter data which is already in table and case sencetive

  • @princepr5830
    @princepr5830 2 года назад

    Here is your content - 8:30

  • @lockhart3673
    @lockhart3673 4 года назад

    syntax error, unexpected '$dbconn' (T_VARIABLE) in C:\xampp\htdocs\Practice\product.php on line 7. I get this error

  • @ASTekProductions
    @ASTekProductions 4 года назад

    Thank you for helping

  • @nimmishareddy2363
    @nimmishareddy2363 4 года назад

    what happens if we dont give alert box?

  • @imvinitmalviya
    @imvinitmalviya 6 лет назад

    Thanks its working

  • @kawsarmobarak4058
    @kawsarmobarak4058 3 года назад

    doesn't work. if you guys watch this video properly you can figure out vide was cuting some of time

  • @santosh7983
    @santosh7983 6 лет назад

    worked thank you

  • @ailton.duarte
    @ailton.duarte 4 года назад

    thanks, i was thing that we can do this with session!!

  • @kmjaseem
    @kmjaseem 4 года назад

    i thought *post/request/get method" is more good solution for this problem. to know more it please google it

  • @kevinpeters1780
    @kevinpeters1780 4 года назад

    Does anyone actually know what causes two records to be inserted ? Is it a response and reply time lag issue?

    • @dhanushmahesh1682
      @dhanushmahesh1682 Год назад

      it is POST REDIRECT GET problem

    • @srinivasaraoyp3640
      @srinivasaraoyp3640 Год назад

      if (mysqli_query($conn, $sql)) {
      header("Location:contact.php");
      // echo "New record has been added successfully !";
      } else {
      echo "Error: " . $sql . ":-" . mysqli_error($conn);
      }
      mysqli_close($conn);

  • @akashkhandelwal1869
    @akashkhandelwal1869 7 лет назад +5

    This is not the solution to stop duplicate values. if the user himself inserting the same values than it will be inserting into database. Try to improve your answer .

    • @ramkisunprasad105
      @ramkisunprasad105 6 лет назад +1

      RamkisunPrasad, Chilbilli, Patna, Bihar, B. Mus, BJP4INDIA, state Council of AYURVEDIC &Unani Medicines, Bihar Government Patna Registered, Life Member -U. L. B. A. Hospital, Japan, Note -PILES, COWARD&SECRETIST (FOR MALE &FEMALE )
      Radhe Radhe Radhe Krishna , Krishna Krishna
      Hare Hare.

  • @surajgupta1148
    @surajgupta1148 4 года назад

    where is the sql query to prevent the duplicate data , you are making fool to you viewers

  • @jyotiofficial2016
    @jyotiofficial2016 2 года назад

    Faltu video

  • @RICHARDICFILES
    @RICHARDICFILES Год назад

    useless