[SOLVED]it worked, then didnt

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Fusion
Forum Newbie
Posts: 13
Joined: Wed May 12, 2004 9:48 am

[SOLVED]it worked, then didnt

Post by Fusion »

hello fokes.

Well, I wrote a script, and it worked, untill I changed the code a little, and changed the table output. Now im getting a Parse error: parse error in /home/computer/public_html/lw/site/scriptphp.php on line 62. The only thing on this line is ?> to close out the php script. Below I have the code before I change it when it worked and after when it didnt. I took out the database info for security reasons:

Code: Select all

<?php

mysql_connect("computer_LWForum", "username", "DFF20466") or
  die("Could not connect: " . mysql_error());
  
$db_name = "computer_LWForum";  // The name of the database where your forums are installed
  
mysql_select_db($db_name);

// Variables
$ibf_members = "ibf_members";  // The name of your members table
$ibf_member_extra = "ibf_member_extra";
$ibf_groups = "ibf_groups";

$top_poster_sql = mysql_query("SELECT name, posts
         FROM $ibf_members m 
         LEFT JOIN $ibf_member_extra me ON me.id=m.id 
         LEFT JOIN $ibf_groups g ON m.mgroup=g.g_id 
         WHERE m.id > 0 AND g.g_hide_from_list <> 1 
         ORDER BY m.posts desc LIMIT 0, 5");

// table header
echo "<table>";
echo "<thead>";
echo "<tr>";
echo "<th>Member Name</th>";
echo "<th>Post Count</th>";
echo "</tr>";
echo "</thead>";

// table body
echo "<tbody>";

while ($row = mysql_fetch_array($top_poster_sql))
{

$NAME   =  $row["name"];
$POSTS   =  $row["posts"];

echo "<tr>";
echo "<td>$NAME</td>";
echo "<td>$POSTS</td>";
echo"</tr>";

}

echo "</tbody>";

// table footer

echo "</table>";

?>

Code: Select all

<?php
mysql_connect("localhost", "db", "pw") or
  die("Could not connect: " . mysql_error());
  
$db_name = "computer_LWForum";  // The name of the database where your forums are installed
  
mysql_select_db($db_name);

// Variables
$ibf_members = "ibf_members";  // The name of your members table
$ibf_member_extra = "ibf_member_extra";
$ibf_groups = "ibf_groups";

$top_poster_sql = mysql_query("SELECT name, posts
         FROM $ibf_members m 
         LEFT JOIN $ibf_member_extra me ON me.id=m.id 
         LEFT JOIN $ibf_groups g ON m.mgroup=g.g_id 
         WHERE m.id > 0 AND g.g_hide_from_list <> 1 
         ORDER BY m.posts desc LIMIT 0, 5");
echo "<table cellpadding=''4'' cellspacing=''1'' border=''0'' width=''100%'' height="145" style="color: #093349\; font-family: Verdana, Tahoma, Arial, sans-serif\; font-size: 10px" id="table52">";
echo "<tr style="color: #093349\; font-family: Verdana, Tahoma, Arial, sans-serif\; font-size: 10px">";
echo "<td colspan=''2'' class=''maintitle'' background=''tile_sub.gif'' height="12">";
echo "<p align="left"><b>.::Top Five PosterZ::.</b></td>";
echo "</tr>";
echo "<tr style="color: #093349\; font-family: Verdana, Tahoma, Arial, sans-serif\; font-size: 10px">";
echo "<td class=''row1'' valign=''middle'' align=''left'' width=''35%'' height="10"><b>Username</b></td>";
echo "<td class=''row1'' valign=''middle'' align=''left'' width=''65%'' height="10">";
echo "<p align="center">";
echo "<b>Posts</b></td>";
echo "</tr>";
			   

while ($row = mysql_fetch_array($top_poster_sql))
{

$NAME   =  $row["name"];
$POSTS   =  $row["posts"];
echo "<tr style="color: #093349\; font-family: Verdana, Tahoma, Arial, sans-serif\; font-size: 10px">";
echo "<td class=''row4'' width=''80%'' height="12" align="left">1. $NAME</td>";
echo "<td class=''row4'' width=''20%'' align=''right'' height="12">$POSTS</td>";
echo "</tr>";
echo "<tr style="color: #093349\; font-family: Verdana, Tahoma, Arial, sans-serif\; font-size: 10px">";
echo "<td class=''row4'' width=''80%'' height="12" align="left">2. $NAME</td>";
echo "<td class=''row4'' width=''20%'' align=''right'' height="12">$POSTS</td>";
echo "</tr>";
echo "<tr style="color: #093349\; font-family: Verdana, Tahoma, Arial, sans-serif\; font-size: 10px">";
echo "<td class=''row4'' width=''80%'' height="12" align="left">3. $NAME</td>";
echo "<td class=''row4'' width=''20%'' align=''right'' height="12">$POSTS</td>";
echo "</tr>";
echo "<tr style="color: #093349\; font-family: Verdana, Tahoma, Arial, sans-serif\; font-size: 10px">";
echo "<td class=''row4'' width=''80%'' height="12" align="left">4. $NAME</td>";
echo "<td class=''row4'' width=''20%'' align=''right'' height="12">$POSTS</td>";
echo "</tr>";
echo "<tr style="color: #093349\; font-family: Verdana, Tahoma, Arial, sans-serif\; font-size: 10px">";
echo "<td class=''row4'' width=''80%'' height="12" align="left">5. $NAME</td>";
echo "<td class=''row4'' width=''20%'' align=''right'' height="12">$POSTS</td>";
echo "</tr>";
echo "</table>";
echo "</td>";
echo "</tr>";
echo "</table>";
?>


thanks for your help, i just cant figure it out
Last edited by Fusion on Tue Jul 13, 2004 6:36 pm, edited 1 time in total.
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post by qads »

apart from lot of messed up print and echo calls, you are missing a } for the while loop.
Fusion
Forum Newbie
Posts: 13
Joined: Wed May 12, 2004 9:48 am

Post by Fusion »

ok the question is, do i need to "\" out the """ and the ";" in the echo strings or not? one,? both? i never got that part of PHP...
Post Reply