Page 1 of 1

Pase error, I can't figuare it out

Posted: Tue Mar 23, 2004 7:22 pm
by seeker2921
Heres the error message I get..

Parse error: parse error in /home/syserror/public_html/site/blog/index.php on line 48

this is line 48: ?>
I don't get what the deal is??

Code: Select all

<?php
//Get Settings
include("settings.php");

 
 /* Connecting to MySQL*/
    $connection = mysql_connect($db_host,$db_user,$db_pass) 
        or die("Could not connect to mysql. Fix me!?!");
      
        /* Select Database. */
     $db = mysql_select_db($database_name,$connection) or die("ARGH, Could not select database."); 
   
  
/* Selecting to show the date, topic, entry on the page.  Sorting by date with most recent at the top. */
//DATE_FORMAT is a built in mysql function readable_date is a temporary field.  
    $sql = "SELECT DATE_FORMAT(date, '%M %e, %Y @ %h:%i %p') AS readable_date,topic,entry,ID FROM $tablename order by date desc";
   $sql_result = mysql_query($sql, $connection) or die("Query failed. Please contact the site <a href=/index.php?id=contact>administrator</a>, and bitch at him."); 
  

/*setting up array and defining result values */
     while ($row = mysql_fetch_array($sql_result)) {  

//defining variables, readable_date is temp field 
$id = $row["ID"]; 
$date = $row["readable_date"];
$topic = $row["topic"];
$entry = $row["entry"]; 
$line_break_format = nl2br($entry);  //Formats the entries you added using add.php to have a line break wherever you did a hard return (hit enter). Change $line_break_format to $entry below if you don't want this. 
echo "<table width=100% cellpadding=2 cellspacing=1 border=0 class=forumline>
		  <tr>
			<td class=catHead height=25><span class=genmed><b>$topic</b></span></td>
		  </tr>
		  <tr>
			<td class=row2 align=left height=24><span class=gensmall><b>Seeker2921</b> $date</span></td>
		  </tr>
		  <tr>
			<td class=row1 align=left><span class=gensmall style=line-height:150%>
$line_break_format
</span></td>
		  </tr>
		</table>
		<br>";
          
    /* Free resultset */
    mysql_free_result($sql_result);
    /* Closing connection */
    mysql_close($connection);
?>

Posted: Tue Mar 23, 2004 7:25 pm
by markl999
You're missing a } to match the
while ($row = mysql_fetch_array($sql_result)) {

Posted: Tue Mar 23, 2004 7:26 pm
by d3ad1ysp0rk
you forgot an ending brace to the while loop ;)

change

Code: Select all

</table> 
      <br>"; 
          
    /* Free resultset */ 
    mysql_free_result($sql_result); 
    /* Closing connection */ 
    mysql_close($connection); 
?>
to

Code: Select all

</table> 
      <br>"; 
          
}
    /* Free resultset */ 
    mysql_free_result($sql_result); 
    /* Closing connection */ 
    mysql_close($connection); 
?>

Posted: Tue Mar 23, 2004 7:26 pm
by tim
is it me, or u dont end your while loop with an

}

?

edit - it wasnt just me! =]

Posted: Tue Mar 23, 2004 7:27 pm
by d3ad1ysp0rk
LoL. I wonder if we should answer it again? Maybe 5 responses will be enough? :lol:

Posted: Tue Mar 23, 2004 7:29 pm
by tim
lol that is just the quality of the members of this board u can expect.

:) :)

Posted: Tue Mar 23, 2004 7:29 pm
by seeker2921
lol, I knew it was going to be something extreamly simple.. Thanks for all of your help I did forget the end brace..