Delete user comment messages from database with PHP - PHP tutorial

Поделиться
HTML-код
  • Опубликовано: 25 окт 2024

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

  • @smashit3406
    @smashit3406 5 месяцев назад

    I'm glad I found your tutorials

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

    so far so good.. all is working.. i will definitely recommend this to all my friends.. greatful I found this tutorial.. Thank you sir.

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

      My edit function is not working

  • @bloofin5259
    @bloofin5259 7 лет назад

    I am learning a lot teach. I added some modifications to my form:
    1. added an error handler to display a message, if the user tries to submit an empty form.
    2. this also prevents empty fields in the database

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

    Very good explanation

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

    Woo! mmtuts you are the man, I went through all 4 tutorials and I found this entire mini series incredibly helpful, on point and relevant. It's beginner friendly too and if advanced users get what's happening they can just guess the steps for themselves. Love people who make such great tutorial content and take their time to guide people along, I feel like I understand PHP more than I did viewing other tutorials.
    Just a question about this comment system, is the Login system you are going to implement able to prevent people from deleting or editing comments that aren't theirs? Would love to hear a reply.

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

    thanks so much
    thamks a lot
    this guys has helped thousands of developer at google including my two friends at microsoft and google.
    thanks sir.

  • @IamJamesA
    @IamJamesA 8 лет назад +1

    Bro thx for the tutorials great videos btw.
    You were the most updated guy in mysqli that i find in youtube.
    But bro lemme give you a tip...
    Why dont you make a tutorial teaching how to make a dynamic site,whit admin page,useres roles.
    And in the admin page you can make a place to see whos online on the site and which page he is on.
    A complete site...
    And this series will be the best one on youtube.

    • @Dani_Krossing
      @Dani_Krossing  8 лет назад +1

      Thanks for the compliments :)
      The hope is to one day get these videos to a point where viewers will be able to create complete CMS systems with all of the above.
      This series gradually teaches PHP from beginners to advanced, so before making more advanced lessons it is important to for newer programmers to learn the foundamentals first.
      At the moment I am too busy to make tutorials while working full-time, but starting around September I will have a lot more free-time to continue these lessons so we can progress a lot further ;)

  • @zxc.Laurence
    @zxc.Laurence 7 лет назад +1

    THANKS SIR !! YOU HELP ME SO GOOOOOOOOOD !!

  • @DariusBlender
    @DariusBlender 4 года назад +4

    I can delete message, but getting error message.How to fix?
    Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\aznews\video1.php:6) in C:\xampp\htdocs\aznews\comments.inc.php on line 67
    If I add exit(), it loads page until I hit F5

  • @hanhduyenha3996
    @hanhduyenha3996 8 лет назад

    So helpful, thank you, I'm so grateful

  • @TheRihins
    @TheRihins 7 лет назад

    Great tutorial :) Can you give me a tip on how to show last inserted comment on top of the page?

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

    Muchos Gracias

  • @EmmanuelHerrera100
    @EmmanuelHerrera100 7 лет назад

    Perfect.!

  • @daz231181
    @daz231181 8 лет назад +1

    Thank you. Helped a lot.
    I have an issue though.
    When I refresh the browser, it put's the last comment in again. How do I fix this please?

    • @Dani_Krossing
      @Dani_Krossing  8 лет назад

      +DazB Yeah a few people have pointed that mistake out. In the video I forgot to include a header() function at the end of the script we made. What it does is to reload the page which fixes it and this is all you need to do to make it work properly :) Just copy one of the previous header() tags we have made in these tutorials.

    • @daz231181
      @daz231181 8 лет назад

      That's great, thank you very much. One other thing if you have time. How can I make a separate comments section for each thing i.e. Video or an image? I don't want the same comments for each video on the page for example.

    • @Dani_Krossing
      @Dani_Krossing  8 лет назад

      To do that, just make sure each page with a new video has a unique "id" and then make sure to include that "id" into the comment as a seperate row when you store it to the database.
      When the comment has the information of which page/video it belongs to, you can then use it to make sure that only comments that has the "id" that matches the page will pop up when you enter the page.
      Hope that explanation made sense :)

    • @daz231181
      @daz231181 8 лет назад

      It does indeed. I will take a look at that today. By far the best tut I found for this. I tried many others before I found yours. Thanks again

    • @leehkfan
      @leehkfan 8 лет назад

      Hi I was wondering if you could explain how to do this a little more? I've been following your excellent tutorial to help me make a users reviews section on my site. Each movie has a page, and on the page I want users to be able to add a review of the film. So I need to be able to have a comments box on multiple pages. So each comments box need to only feature comments for that specific film. I don't understand how to add a unique id as you mentioned. I also only want one or two reviews to appear at a time, with the option to click to see more. Is that possible? Thank you in advance for any advice or tips you can provide.

  • @bamalam304
    @bamalam304 8 лет назад

    I wonder how you should seperate comments for different pages. What would you do?

    • @bamalam304
      @bamalam304 8 лет назад

      Solved it! Added another column to comments in database called "page" and made the current page send it to the database. Then I added in getComments:
      $sql = "SELECT * FROM comments WHERE page='".$_SERVER['REQUEST_URI']."'";

  • @Plut0-YT
    @Plut0-YT 7 лет назад +2

    This is still an issue:
    "Hello sir, when I click the delete buttom, the comment gets deleted from the database but it still stays VISUALLY on the page, untill I refresh the page and then it's gone. Why do I have to refresh the page to make it gone. Also my header function is not working."

    • @YOLO-fz5sx
      @YOLO-fz5sx 7 лет назад

      I have same, how did you fix it?

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

      you need to make sure that the data is fetched from database after you delete :)

    • @sablyr6s261
      @sablyr6s261 6 лет назад +4

      function deleteComments($conn){
      if (isset($_POST['commentDelete'])) {
      $cid = $_POST['cid'];
      $sql = "DELETE FROM comments WHERE cid='$cid'";
      $result = mysqli_query($conn, $sql);
      echo "";
      }
      }
      That worked for me, gl

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

      @@sablyr6s261me too

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

      @@sablyr6s261 Thanx bro

  • @filippetrovic240
    @filippetrovic240 8 лет назад

    Hey mmtuts,
    I watched your series but one thing is missing.
    Do you can create a User to User system with PhP? Not writing persons on their profiles as comment, but a chat, there are listed your friends and when you click on a friend, user whatever, you can write him or her, do you know what I mean? Sorry for my bad english, I'm german and 15, but I love programming Websites :)
    With regards!
    Filip

    • @Dani_Krossing
      @Dani_Krossing  8 лет назад

      +Filip Petrovic
      Hi there! Don't worry about your English it sounds great ;)
      Regarding a "chat" system where two users can talk to one another, it is definitely possible to make using PHP.
      However in order for the chat system to be instant so that a message pops up whenever you write another person, you will have to include something called AJAX.
      AJAX is essentially JavaScript mixed with PHP that allows for a website to get information and display it without having to load the page manually each time you want to see, as an example, newly received messages.
      This is why I will not show how to make a chat in this tutorial series, yet atleast. Because I have no wish to include JavaScript into a PHP series until it has advanced far enough.

    • @filippetrovic240
      @filippetrovic240 8 лет назад

      +mmtuts Thanks for your quick reply!
      Please make then a another playlist or so... I saw many people with this trouble, you can maybe solve my and their problem... It would be very nice! Maybe a Social network playlist or something like that, with comments on (e. g.) my profile and yeah... Please make some videos about it!

  • @rgarcia6753
    @rgarcia6753 7 лет назад

    can you make a video tutorial how to delete a data in the database. in just 1 text box and 1 button? tia!

  • @turboromy
    @turboromy 8 лет назад

    8:14 What's a difference ???? Refreshing and completely refreshing ? I wonder if this was why Chrome didn't work for a while.

  • @ClassicCartoonsNL
    @ClassicCartoonsNL 7 лет назад

    It would be nice to see the edited form in the same page as comment page.

  • @cjrpascual
    @cjrpascual 8 лет назад +1

    Why such when I refresh It .. It loops ... why ??? why it adds same comment to a database ?? please answer me .. thank you

    • @Dani_Krossing
      @Dani_Krossing  8 лет назад

      Add "exit();" at the end of the script to stop it from continuing looping.

    • @12NightSide
      @12NightSide 8 лет назад

      On which script do you add "exit();"? BTW, excellent tutorials! I've learned a lot from them!

    • @Dani_Krossing
      @Dani_Krossing  8 лет назад

      Anytime you get to the end of a series of statements :) It stops the rest of the code from running

  • @vojka2973
    @vojka2973 7 лет назад

    Hello sir, when I click the delete buttom, the comment gets deleted from the database but it still stays VISUALLY on the page, untill I refresh the page and then it's gone. Why do I have to refresh the page to make it gone. Also my header function is not working.

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

      function deleteComments($conn){
      if (isset($_POST['commentDelete'])) {
      $cid = $_POST['cid'];
      $sql = "DELETE FROM comments WHERE cid='$cid'";
      $result = mysqli_query($conn, $sql);
      echo "";
      }
      }
      That worked for me, gl

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

    hi after following your steps i got this error
    Forbidden
    You don't have permission to access this resource.
    Apache/2.4.54 (Win64) OpenSSL/1.1.1p PHP/8.2.0 Server at localhost Port 80

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

    How can i only delete my posts not all posts

  • @rdevilfang
    @rdevilfang 7 лет назад

    hi sir can put a confirmation message from delete ... help please sir

  • @goglesuciha4321
    @goglesuciha4321 7 лет назад +1

    Warning: Cannot modify header information - headers already sent by (output started at C:\xamppp\htdocs\GameBox\post.inc.php:31) in C:\xamppp\htdocs\GameBox\post.inc.php on line 95
    what to do for this kind of warnings ? plzz response ...
    the error is showing for header(Location : forum.php ); at delete function
    plz response mmtuts .. this is very important .. my project is stack in here for that reason plzzz mmtuts response :\

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

    Good video, but how can I make it so that not every user can delete comments? I want it so that only the owner of the comment can delete it.

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

    Plz plz upload full tutorial on reply

  • @ROHITRAJPUT-ud6xr
    @ROHITRAJPUT-ud6xr 4 года назад

    this code problem in server pls help becuse webpage half hide

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

    i have this error message can you help me? - Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\php\KitchenStories\blog_post.php:82) in C:\xampp\htdocs\php\KitchenStories\comments.inc.php on line 62

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

      I get the same error! Guess we'll both stuck.

  • @blessiesabarre8921
    @blessiesabarre8921 7 лет назад

    i cannot click the delete button

    • @zxc.Laurence
      @zxc.Laurence 7 лет назад

      try to move form of deleteComment under form of editComment

  • @eosapril
    @eosapril 8 лет назад

    at last ;)

  • @frhizzy2746
    @frhizzy2746 8 лет назад

    Can you please do a giveaway?