Jump to content

profile comment help


quickstopman

Recommended Posts

i currently have a user profile system and i want to make it so someone can post a comment on there profile

but..

it doesn't work

here is a list of the rows in the table

 

user_id // is i think what will make it so it only shows the comments sent to that user

timdate

commentID

user

comment

 

here is the code:

<?
ob_start();
session_start();
require 'config.php';
$id = $_GET['id'];
$user = $_SESSION['username'];

if (isset($_SESSION['username'])) {

$sql = mysql_query("SELECT * FROM `profile_comment` WHERE user_id = '{$id}' ORDER BY timedate") OR die(mysql_error());
$comments = mysql_fetch_array($sql);
while($list = $comments) {
$list['user'];
}

$username = $_POST[$user];
$comment = $_POST['comment'];
$submit = $_POST['submit'];

if ($submit) {
$post = mysql_query("INSERT INTO `profile_comment` SET (`id` = '$id', `user` = '$username', `comment` = '$comment') WHERE commentID");
echo "Your comment has been Submitted.";
} else {

?>
<form method='POST' action='profile.php?id=<? echo $id; ?>'>
<textarea cols='20' rows='5' name='comment'></textarea><br>
<input type='submit' value='Submit Comment' name='submit'>
<?

}

} else {

echo 'Please <a href="userlogin.php">Login</a> or <a href="register.php">Register</a><br>
to Comment.';
}

?>

any help would be nice. :)

Link to comment
https://forums.phpfreaks.com/topic/51744-profile-comment-help/
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.