Jump to content

Changing data


ngreenwood6

Recommended Posts

Hello all,

 

I have created a section on my site where users can post comments. I as the admin would like to be able to edit these comments or delete them if necessary.  I am trying to figure out how to edit or delete them by which one I choose.  My page looks something like this:

 

<?php

$host = "localhost";
$db = "test";
$user = "user";
$pass = "pass";

mysql_connect($host, $user, $pass);

mysql_select_db($db);

$query = "SELECT comment from table_name";

while ($row = mysql_fetch_array($query))
{
echo "$row <br>";
}

?>

 

This pretty much prints the comments to the page with a break after each comment. I want to have a simple little button like this to edit the comment or delete it:

<a href="edit.php">edit</a>

 

 

The problem I have is that I do not know how to edit that specific comment. The reason is because it is not always going to be the same comment. I would like to be able to pull it into something like this where $comment is the users comment so that I can see what is there and just edit it:

 

<textarea value="$comment"> </textarea>

 

Any help is appreciated. If you have any questions feel free to ask.

Link to comment
https://forums.phpfreaks.com/topic/122402-changing-data/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.