I have been running over the code time and time again, and I cannot seem to find the culprit. The other topic_title variable comes up fine, but the others post_title, post_text do not. I have tried many things and they are still not showing up on the page...
I appreciate any help with this!
I figure the problem to be in this segment of code but I am not sure and have also included the entire code for perusal.
// Gather the posts
$get_posts = "select post_text, post_id, date_format(post_create_time, '%b %e %Y at %r')
as fmt_post_create_time, post_owner from Faq_Posts where topic_id = $_GET[topic_id] order by post_create_time asc";
$get_posts_res = mysql_query($get_posts,$conn) or die(mysql_error());
// Create the display string
$display_block = "<p>Showing answer to the <b>$topic_title</b> topic:</p>
<table width=\"100%\" cellpadding=3 cellspacing=1 border=0><tr><th>Author</th><th>Post</th></tr>";
while($posts_info = mysql_fetch_array($get_posts_res)){
$post_id = $posts_info['post_id'];
$post_text = nl2br(stripslashes($posts_info['post_text']));
$post_create_time = $posts_info['fmt_post_create_time'];
$post_owner = stripslashes($posts_info['post_owner']);
:::::::::::::::::::FULL CODE BELOW:::::::::::::::::::::
<?php
// Check for required info from the query string
if(!$_GET[topic_id]){
header("Location: topiclist.php"
exit;
}
// Connect to DB
include('dbconf.php');
// Verify the topic exists
$verify_topic = "select topic_title from Faq_Topics where topic_id = $_GET[topic_id]";
$verify_topic_res = mysql_query($verify_topic,$conn) or die(mysql_error());
if(mysql_num_rows($verify_topic_res) < 1){
// This topic does not exist
$display_block = "<p><b>You have selected an invalid topic</b>. Please <a href=\"topiclist.php\"> Try
again</a>.</p>";
}else{
// Get topic title
$topic_title = stripslashes(mysql_result($verify_topic_res,0,'topic_title'));
// Gather the posts
$get_posts = "select post_text, post_id, date_format(post_create_time, '%b %e %Y at %r')
as fmt_post_create_time, post_owner from Faq_Posts where topic_id = $_GET[topic_id] order by post_create_time asc";
$get_posts_res = mysql_query($get_posts,$conn) or die(mysql_error());
// Create the display string
$display_block = "<p>Showing answer to the <b>$topic_title</b> topic:</p>
<table width=\"100%\" cellpadding=3 cellspacing=1 border=0><tr><th>Author</th><th>Post</th></tr>";
while($posts_info = mysql_fetch_array($get_posts_res)){
$post_id = $posts_info['post_id'];
$post_text = nl2br(stripslashes($posts_info['post_text']));
$post_create_time = $posts_info['fmt_post_create_time'];
$post_owner = stripslashes($posts_info['post_owner']);
// Add to display
$display_block .= "<tr><td width=35% valign=top>$post_owner<br>[$post_create_time]</td>
<td width=65% valign=top>$post_text<br></td></tr>";
}
// Close up the table
$display_block .="</table>";
}
?>
<html>
<head>
<title>Posted FAQ Answers</title>
</head>
<body>
<h3>Posted Answers in Topic</h3>
<?php print $display_block; ?>
<br><br>
<a href="topiclist.php">Return to topic list</a>
<body>
</html>
Rninja
I appreciate any help with this!
I figure the problem to be in this segment of code but I am not sure and have also included the entire code for perusal.
// Gather the posts
$get_posts = "select post_text, post_id, date_format(post_create_time, '%b %e %Y at %r')
as fmt_post_create_time, post_owner from Faq_Posts where topic_id = $_GET[topic_id] order by post_create_time asc";
$get_posts_res = mysql_query($get_posts,$conn) or die(mysql_error());
// Create the display string
$display_block = "<p>Showing answer to the <b>$topic_title</b> topic:</p>
<table width=\"100%\" cellpadding=3 cellspacing=1 border=0><tr><th>Author</th><th>Post</th></tr>";
while($posts_info = mysql_fetch_array($get_posts_res)){
$post_id = $posts_info['post_id'];
$post_text = nl2br(stripslashes($posts_info['post_text']));
$post_create_time = $posts_info['fmt_post_create_time'];
$post_owner = stripslashes($posts_info['post_owner']);
:::::::::::::::::::FULL CODE BELOW:::::::::::::::::::::
<?php
// Check for required info from the query string
if(!$_GET[topic_id]){
header("Location: topiclist.php"
exit;
}
// Connect to DB
include('dbconf.php');
// Verify the topic exists
$verify_topic = "select topic_title from Faq_Topics where topic_id = $_GET[topic_id]";
$verify_topic_res = mysql_query($verify_topic,$conn) or die(mysql_error());
if(mysql_num_rows($verify_topic_res) < 1){
// This topic does not exist
$display_block = "<p><b>You have selected an invalid topic</b>. Please <a href=\"topiclist.php\"> Try
again</a>.</p>";
}else{
// Get topic title
$topic_title = stripslashes(mysql_result($verify_topic_res,0,'topic_title'));
// Gather the posts
$get_posts = "select post_text, post_id, date_format(post_create_time, '%b %e %Y at %r')
as fmt_post_create_time, post_owner from Faq_Posts where topic_id = $_GET[topic_id] order by post_create_time asc";
$get_posts_res = mysql_query($get_posts,$conn) or die(mysql_error());
// Create the display string
$display_block = "<p>Showing answer to the <b>$topic_title</b> topic:</p>
<table width=\"100%\" cellpadding=3 cellspacing=1 border=0><tr><th>Author</th><th>Post</th></tr>";
while($posts_info = mysql_fetch_array($get_posts_res)){
$post_id = $posts_info['post_id'];
$post_text = nl2br(stripslashes($posts_info['post_text']));
$post_create_time = $posts_info['fmt_post_create_time'];
$post_owner = stripslashes($posts_info['post_owner']);
// Add to display
$display_block .= "<tr><td width=35% valign=top>$post_owner<br>[$post_create_time]</td>
<td width=65% valign=top>$post_text<br></td></tr>";
}
// Close up the table
$display_block .="</table>";
}
?>
<html>
<head>
<title>Posted FAQ Answers</title>
</head>
<body>
<h3>Posted Answers in Topic</h3>
<?php print $display_block; ?>
<br><br>
<a href="topiclist.php">Return to topic list</a>
<body>
</html>
Rninja