Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.