Hello again,
I'm trying to display the ten latest news articles from my database in a certain fashion using a file called newsarchive.php. Here is the code I have in it:
<?php
include "header.php";
//CONNECT TO THE DATABASE
$dbh=mysql_connect ("REMOVED", "REMOVED", "REMOVED") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("REMOVED");
$start = $_GET['start'] ;
?>
<td width="100%">
<div align="center">
<table border="0" width="502" cellspacing="0" bgcolor="#000000">
<tr>
<td width="100%">
<table border="0" width="100%" bgcolor="#FFFFFF" cellspacing="0" cellpadding="5" background="images/background_articles.gif">
<tr>
<td width="500" height="29" background="sections/news.gif"> </td>
</tr>
<tr>
<td width="500">
<?php
//FIRST ARTICLE
$result = mysql_query("SELECT * FROM `news` ORDER BY `date` DESC LIMIT $start , 10");
while ($array = mysql_fetch_array($result)) {
$id = $array['id'];
$date = $array['date'];
$story_short = $array['story_short'];
$headline = $array['headline'];
//WHOSE CHILD IS THIS?!?!?
$result = mysql_query("SELECT `realname`,`avatar` FROM `staff` WHERE `id` = '$array['staffid']'");
while ($array = mysql_fetch_array($result)) {
$username = $array['realname'];
$avatar = $array['avatar'];
echo "
<p><img border='1' src='icons/rides/$avatar.gif" align='right' width='75' height='75'><font size='3' face='Arial'><b>$headline<br></b></font><i><font face='Arial' size='2'>Posted by $realname on $date<br></font></i><font face='Arial' size='2'>$story_full<br></font><a href='articles.php?id=$id'><font face='Arial' size='1'>Read more...</font></a></p>";
}
}
?>
<p align="center"><u><font face="Arial" size="2">Older
News</font></u>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
<?php
include "footer.php";
?>
When I run this, it gives me the following error message:
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in path/to/newsarchive.php on line 30
Any help would be GREAT.
Thanks,
~ Reality