Jump to content

odd mysql_query select


quickstopman

Recommended Posts

hey guys

im a homemade forum

and in my page where you can view the post it shows the users knickname

i made it so when you post a topic it put the users id in the posted_by section

and when your on the page it mysql_query selects the user knickname

but in stead of that it just say request id #5

 

here is the code:

<?
ob_start();
session_start();
include("header.php");
include("config.php");

if (isset($_GET['postID']) && is_numeric($_GET['postID'])) {
$sql = mysql_query("SELECT * FROM post WHERE id='". $_GET['postID'] ."'");
$info['post'] = mysql_fetch_array($sql) or die(mysql_error());
$postername = mysql_query("SELECT knickname FROM users WHERE id = '{$info['post']['posted_by']}' ");
if (empty($info['post'])) {
echo "The post your are looking for has either been deleted or doesn't exist yet";
} else {
echo $info['post']['topic'];
echo " Posted By: ". $postername ."<br><br>";
echo $info['post']['content'];
}
} else {
header("Location:posts.php");
}
?>

Link to comment
https://forums.phpfreaks.com/topic/58892-odd-mysql_query-select/
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.