Change user comment in database using PHP - PHP tutorial

preview_player
Показать описание
How to edit a comment message using PHP - Learn PHP backend programming. Today we will create a script that allow for us to edit the comments we inserted into the database.

--

mmtuts is a YouTube channel that focuses on teaching beginner and advanced courses in various multimedia related skills.
We plan to make tutorials available on programming, video production, animation, graphic design, and on software such as the Adobe Creative Cloud programs.

PHP for beginners is a how to series that teaches the PHP coding language to people who are just starting out learning programming. The course teaches how PHP scripting can be made easy and teaches how to build many apps such as a login system, a comment section, how to upload images, how to create users in a website, and much more. Creating dynamic websites with PHP is easy and should not be seen as otherwise, which is why we want to explain the language in a easy to understand way for beginners.

If you have suggestions on new courses, or specific lessons within existing courses you would like to see, then feel welcome to submit them in the comment section or in a private message. ALL suggestions will be seen, but not all will be replied to since we get quite a few every day.
Рекомендации по теме
Комментарии
Автор

This PHP tutorial has been so helpful! I'm coding a web app that features up-and-coming web developers and this series played a huge part in my ability to code the comment section. Thank you mmtuts!

RealToughCandy
Автор

Very easy and smooth way of teaching, I have one request that pls add reply button as well and save all the stuff to database like youtube can see below using AJAX.

DeepakSahu-wgdu
Автор

thanks so much
I still watching this video and really happy for having you as instructor

gabrielfono
Автор

Hi there! I have followed your tutorial (which i think is the best source on youtube) and everything is working except i'm not being re-directed to the index page when i edit a message? i have checked my header function over and over and it is definitely correct? When i hit the back button to get back to the index page and refresh the page the message is edited fine? is this some sort of bug?

clivechambers
Автор

When will you show how to edit comments using JavaScript and PHP? Please reply back. Thanks! :)

VectorRoblox
Автор

Hi mmtuts, I figured out how to use JavaScript for how to edit comments on the same page! But I have one problem: When you did ($sql = "UPDATE comments SET message='$message' WHERE cid='$cid'";) on the editComments($conn) function, how do you do it with JavaScript and jQuery? Thank you for this video by the way!

VectorRoblox
Автор

Here are some possible solutions if you have problems with your code:

1) Some people may place their php files in different folders, make sure your action="??.php" redirects backwards a folder or fowards a folder if you place php files in different folders. The mmtuts guy places his php files in the same directory so he doesn't need any prefixes like ../ or /

2) The mmtut's guy tabs text is really small so it's hard to see which tab he is on and causes users to place wrong code in wrong files and the names all have similar key words like "edit" and "comment". One time I accidentally placed a "Location: index.php" in the wrong tab which caused me to not see the page I wanted; Yes you do get to the page but the isset on the page automatically redirects you back to the index.php which makes it look like the action="editcomment.php" look like it's doing nothing

3) Sometimes he does bug fixes later in the video so just forwards a bit and he will show you what he did wrong and how to fix them

rcsx
Автор

Hello,

Awesome series! Just a question, when i style my edit form, the first comment section is not included. Does it like run the script before the styleing once? Is there a way to solve this problem.

roiscl
Автор

Hi mmtuts, Thanks alot for these tutorials.

wilsongaturu
Автор

you tutorial has indeed help my carrier

codewithhabibi
Автор

I had a question. Lets say i can create posts and i want a new comment section related to that post each time, how do i do it? Each time i create a post it gives me the same comments that were saved.

pvdc
Автор

I love your videos.... I just wish you could answers some of the questions. You might get fewer repeated questions. A++ vids though!!

ohiofarmer
Автор

thanks a lot av watched all ur videos and it has really help my carrier, but i'm having a slight problem trying to write the code for reply comment, i have written this code but is not working like i intended, whenever i reply to particular comment it will appear in all other comments on the page as well. i will appreciate it if you can just make a video demonstrating what i need to do to achieve this prefectly.

codewithhabibi
Автор

Hi thank you so much for the tutorials, they are great!
I have an issue:
Yesterday it was fine and I could add comments to my post
but then today U try it again and is was not working
when I click on the submit button nothing happens
what cou;d be the problem?

orelhassid
Автор

I got a question. It looks like "absolute" within edit-form { } relates to .comment-box's "relative". But when I experimented putting "position:relative" to diff locations like within textarea, iframe, etc... that "edit" goes all the way to upper right hand corner like at 6:55. How does your code limit that edit goes within nothing but comment-box ?

turboromy
Автор

You probably not gonna respond but i have an issue, when i insert the input data into my database it is in UTF-8 but it doesnt come out as utf-8 when i get it from the database (Talking about the comment box form)

ssandzz
Автор

Hey!! I really loved your tutorials and they helped me a lot as well. As a beneficiary of your lessons, I would request you to make another lesson featuring on how to edit using javascript and php as you mentioned on 1:27.. Or if you already have it created, please provide me with the link. Thanks!!

sbibhas
Автор

At 3:30, you do value=' " . $rowp'uid'] . " ' Is there a name for this structure / grammar ? I just memorized the way it is written but without knowing why or what it is called.

turboromy
Автор

First of all thinks for your hard work it helped me a lot, and can you add the link for your java script video about comment editing, surly I'll need a lot of java script soon at some point but for now doing comments !, and thanks.

creepystalker
Автор

for people having undefined index on the editcomment.php, solution to me was to not include any function but the editComments on that file, but i didnt have separate folders for every function i just wrote them in the index file, and so when creating editcomment.php i just deleted all the functions and only left the editComments and it works...

nerminkarapandzic
welcome to shbcf.ru