Wrox Programmer Forums
|
BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5
This is the forum to discuss the Wrox book Beginning PHP4 by Wankyu Choi, Allan Kent, Chris Lea, Ganesh Prasad, Chris Ullman; ISBN: 9780764543647
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 28th, 2005, 05:06 PM
Registered User
 
Join Date: Mar 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default T_VARIABLE

Hi, I dont know why, but I keep getting a parse error whenever I load this script.
The error is unexpected T_VARIABLE on line 31.
I have marked the line that has the problem.

<?php
// connected to database (this bit of code has been taken out for security reasons.)

$verify_topic = "select topic_title from forum_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) {
   $display_block = "<P><em>You have selected an invalid topic. Please try again.<em></p>";
} else {
   $topic_title = stripslashes(mysql_result($verify_topic_res,0,'top ic_title'));

$get_posts = "select post_id, post_text, date_format(post_create_time, '%b %e %Y at %r') as fmt_post_create_time, post_owner from forum_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());

$display_block = "<P>Showing posts for the $topic_title topic:</p>

<table width=100% cellpadding=3 cellspacing=1 border=1>
<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']);z

// THE NEXT LINE HAS THE T_VARIABLE ERROR:

    $display_block .= "
    <tr>
    <td width=35% valign=top>$post_owner<br>[$post_create_time]</td>
    <td width=65% valign=top>$post_text<br><br>
     <a href=\"replytopost.php?post_id=$post_id\"><strong> REPLY TO POST</strong></a></td>
    </tr>";
  {

  $display_block .= "</table>";
}
?>
<html>
<head>
<title>Forum</title>
</head>
<body>
<h1>Posts in Topic</h1>
<?php echo $display_block; ?>
</body>
</html>





Similar Threads
Thread Thread Starter Forum Replies Last Post
Unexpected T_VARIABLE deamato BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 February 26th, 2005 08:11 PM
Unexpected : t_string, t_variable, t_num_string scifo PHP Databases 13 November 15th, 2004 05:08 AM
what is the problem of T_VARIABLE in Chapter 3? lancet2003 BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 6 October 24th, 2003 09:25 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.