Reply
Parse Error - Please Help
Old 03-27-2006, 03:23 PM Parse Error - Please Help
Skilled Talker

Posts: 69
Hello,

This is the error I'm getting : Parse error: parse error, unexpected $ in link/to/my/file/news.php on line 48

Here is news.php

PHP Code:
<?php

//CONNECT TO THE DATABASE
$link=mysql_connect('HOST','LOGIN','PASSWORD')
or die(
'Could not connect: ' mysql_error());
mysql_select_db('DATABASE') or die('Could not select database');

//FIRST FOUR NEWS ARTICLES
$result mysql_query("SELECT * FROM `news` ORDER BY `date` DESC LIMIT 0 , 4");
while (
$array mysql_fetch_array($result)) {
$id $array['id'];
$date $array['date'];
$staffid $array['staffid'];
$story_full $array['story_full'];
$story_short $array['story_short'];
$headline $array['headline'];

//WHOSE CHILD IS THIS?!?!?
$result mysql_query("SELECT `username`,`avatar` FROM `staff` WHERE `id` = '$staffid'");
while (
$array mysql_fetch_array($result)) {
$username $array['username'];
$avatar $array['avatar'];

echo 
"<tr><td width='100%'><img border='1' src='icons/rides/$avatar.gif' align='left' width='75' height='75'><b><font face='Arial' size='2'>$headline<br></font></b><font face='Arial' size='1'><i>Posted on $date by $username<br></i></font><font face='Arial' size='2'>$story_short</font><font face='Arial' size='1'><br><u>Read More...</u></font></td></tr><tr><td width='100%'><img border='0' src='images/1_6.gif' width='375' height='1'></td></tr>";
}

//GET ALL OF THE ENTRIES FROM ONE CATEGORY IN A DIFFERENT ORDER
$result mysql_query("SELECT * FROM `news` ORDER BY `date` DESC LIMIT 4 , 1");
while (
$array mysql_fetch_array($result)) {
$id $array['id'];
$date $array['date'];
$staffid $array['staffid'];
$story_full $array['story_full'];
$story_short $array['story_short'];
$headline $array['headline'];

//WHOSE CHILD IS THIS?!?!?
$result mysql_query("SELECT `username`,`avatar` FROM `staff` WHERE `id` = '$staffid'");
while (
$array mysql_fetch_array($result)) {
$username $array['username'];
$avatar $array['avatar'];

echo 
"<tr><td width='100%'><img border='1' src='icons/rides/$avatar.gif' align='left' width='75' height='75'><b><font face='Arial' size='2'>$headline<br></font></b><font face='Arial' size='1'><i>Posted on $date by $username<br></i></font><font face='Arial' size='2'>$story_short</font><font face='Arial' size='1'><br><u>Read More...</u></font></td></tr>";
}

//DISCONNECT FROM THE DATABASE
mysql_close($link);
?>
Any clue what I did wrong?

*~* Reality15
Owner of MIRollerCoast.com
Webmaster of PointXtreme.com

Last edited by Reality15 : 03-27-2006 at 03:25 PM.
Reality15 is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 03-27-2006, 04:16 PM Re: Parse Error - Please Help
chrishirst's Avatar
Super Moderator

Posts: 13,517
Location: Blackpool. UK
and line 48 would be ???
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-27-2006, 04:16 PM Re: Parse Error - Please Help
capetek's Avatar
Extreme Talker

Posts: 229
Location: Massachusetts
//FIRST FOUR NEWS ARTICLES
$result = mysql_query("SELECT * FROM `news` ORDER BY `date` DESC LIMIT 0 , 4");
while ($array = mysql_fetch_array($result)) {
$id = $array['id'];
$date = $array['date'];
$staffid = $array['staffid'];
$story_full = $array['story_full'];
$story_short = $array['story_short'];
$headline = $array['headline'];


You forgot to close a few brackets
__________________
Anthony LeBoeuf
Cape-Tek IT Solutions
www.cape-tek.com
Great hosting at affordable pricing!

Last edited by capetek : 03-27-2006 at 04:19 PM.
capetek is offline
Reply With Quote
View Public Profile Visit capetek's homepage!
 
Old 03-27-2006, 04:39 PM Re: Parse Error - Please Help
Skilled Talker

Posts: 69
Thank you!

Here's another problem I'm having. I want the date/time in the following format, stored for $date. How do I do that?

FORMAT: 2006-03-27 16:36:05

Here's what I have:

PHP Code:
while ($array getdate()) {
$seconds $array['seconds'];
$minutes $array['minutes'];
$hours $array['hours'];
$mday $array['mday'];
$mon $array['mon'];
$year $array['year'];

$date "$year-$mon-$mday $hours:$minutes:$seconds";


Thanks!
Reality15 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Parse Error - Please Help
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 10.13135 seconds with 12 queries