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
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.
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.
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 ;)
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
+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.
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.
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 :)
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.
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']."'";
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."
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
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
+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.
+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!
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.
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
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
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 :\
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
I'm glad I found your tutorials
so far so good.. all is working.. i will definitely recommend this to all my friends.. greatful I found this tutorial.. Thank you sir.
My edit function is not working
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
Very good explanation
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.
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.
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.
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 ;)
THANKS SIR !! YOU HELP ME SO GOOOOOOOOOD !!
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
So helpful, thank you, I'm so grateful
Great tutorial :) Can you give me a tip on how to show last inserted comment on top of the page?
Muchos Gracias
Perfect.!
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?
+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.
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.
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 :)
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
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.
I wonder how you should seperate comments for different pages. What would you do?
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']."'";
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."
I have same, how did you fix it?
you need to make sure that the data is fetched from database after you delete :)
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
@@sablyr6s261me too
@@sablyr6s261 Thanx bro
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
+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.
+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!
can you make a video tutorial how to delete a data in the database. in just 1 text box and 1 button? tia!
8:14 What's a difference ???? Refreshing and completely refreshing ? I wonder if this was why Chrome didn't work for a while.
It would be nice to see the edited form in the same page as comment page.
Why such when I refresh It .. It loops ... why ??? why it adds same comment to a database ?? please answer me .. thank you
Add "exit();" at the end of the script to stop it from continuing looping.
On which script do you add "exit();"? BTW, excellent tutorials! I've learned a lot from them!
Anytime you get to the end of a series of statements :) It stops the rest of the code from running
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.
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
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
How can i only delete my posts not all posts
hi sir can put a confirmation message from delete ... help please sir
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 :\
I tried this and it worked for me. Write it at the very top where you start the php:
yes it worked :)
Thanks man.
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.
Plz plz upload full tutorial on reply
this code problem in server pls help becuse webpage half hide
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
I get the same error! Guess we'll both stuck.
i cannot click the delete button
try to move form of deleteComment under form of editComment
at last ;)
Can you please do a giveaway?