Hello again
could use some help with this…
At the moment I have a post system on my index page which displays the latest posts made by any administrator. The administrators can of course log in to the site at any time and then choose to make a new post.
The problem right now is that the post doesn’t say who submitted the post, when in fact it should display the administrator’s name.
I have two tables here, one that stores the post’s information such as title, body, id, date and poster. And then I have another table that contains information about the administrator like first name and username etc.
Right now it returns “Resource id #10” as $poster instead of the first name
[php] if($_POST[‘post’]) {
$title = $_POST[‘title’];
$body = $_POST[‘body’];
$title = htmlentities($title, ENT_COMPAT, 'ISO-8859-15');
$body = htmlentities($body, ENT_COMPAT, 'ISO-8859-15');
if($title && $body) {
// get current date
$date = date("Y-m-d");
// get user id
$userid = $_SESSION['user_id'];
// get poster
$poster = mysql_query("SELECT `first_name` FROM `users` WHERE `user_id` = '$userid'") or die(mysql_error());
// insert the information into table
$insert = mysql_query("INSERT INTO `news` VALUES ('$id', '$title', '$body', '$date', '$poster')") or die(mysql_error());
// redirect
header('Location: post.php?success');
exit();
} else {
$errors[] = 'Both fields are required.';
}
}[/php]
Any help is appreciated…

