Jump to content


Photo

hey can u help me with an error in script??


  • Please log in to reply
7 replies to this topic

#1 runnerjp

runnerjp
  • Members
  • PipPipPip
  • Advanced Member
  • 2,214 posts

Posted 29 August 2006 - 11:51 AM

Parse error: syntax error, unexpected T_ECHO in /home/runnerse/public_html/chatbox/maq.php on line 20

<?php
#################################
include("chatbox/connect.php");
#################################

mysql_connect($host,$dbuser,$dbpass) or die(mysql_error());
// Select the database.
mysql_select_db($dbname) or die(mysql_error());
$query = "SELECT poster, message FROM ch_messages order by id DESC LIMIT 5";
$result = mysql_query($query);
$marquee = "";
$i = 0;
while($r=mysql_fetch_array($result))
{
   $posts[$i] = $r[poster].' - '. $r[message]. '';
   ++$i;
}
$marquee = implode("<img src='http://www.runnerselite.com/image/runner.gif'>", $posts)

echo "<marquee><font size='3'><span style='color: white'>". $marquee. "</span></font></marquee>"

?>code]


#2 ronverdonk

ronverdonk
  • Members
  • PipPipPip
  • Advanced Member
  • 277 posts
  • LocationNetherlands

Posted 29 August 2006 - 11:59 AM

Your last echo must be ended with a semi-colon (;)

Ronald  8)
RTFM is an almost extinct art form, it should be subsidized.

#3 Jenk

Jenk
  • Members
  • PipPipPip
  • Advanced Member
  • 778 posts

Posted 29 August 2006 - 12:00 PM

Whilst the above is correct, the error is actually produced because you need a semi-colon at the end of your line with implode() function.

#4 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 29 August 2006 - 12:01 PM

Missing terminating semi-colon on this line:
<?php $marquee = implode("<img src='http://www.runnerselite.com/image/runner.gif'>", $posts) ?>

With this type of error, always look in the preceding lines, as well as the line indicated for the syntax error.

Ken

#5 runnerjp

runnerjp
  • Members
  • PipPipPip
  • Advanced Member
  • 2,214 posts

Posted 29 August 2006 - 12:06 PM

ok i did all that u said

<?php
#################################
include("chatbox/connect.php");
#################################

mysql_connect($host,$dbuser,$dbpass) or die(mysql_error());
// Select the database.
mysql_select_db($dbname) or die(mysql_error());
$query = "SELECT poster, message FROM ch_messages order by id DESC LIMIT 5";
$result = mysql_query($query);
$marquee = "";
$i = 0;
while($r=mysql_fetch_array($result))
{
   $posts[$i] = $r[poster].' - '. $r[message]. '';
   ++$i;
}
$marquee = implode("<img src='http://www.runnerselite.com/image/runner.gif'>", $posts) ?

echo "<marquee><font size='3'><span style='color: white'>". $marquee. "</span></font></marquee>";

?>

yet still an error on lien 20 :S

#6 Jenk

Jenk
  • Members
  • PipPipPip
  • Advanced Member
  • 778 posts

Posted 29 August 2006 - 12:09 PM

Have a read on php.net about syntax.

#7 paul2463

paul2463
  • Members
  • PipPipPip
  • Advanced Member
  • 955 posts
  • LocationUK

Posted 29 August 2006 - 12:10 PM

still missing the semi-colon at the end of the implode line, not a question mark
you cannot affect the past but you can ruin a perfectly good present by worrying about the future

*********************************************************************
The <A HREF="http://www.php.net/d...php">MANUAL</A> is actually a useful resource

#8 Iceman512

Iceman512
  • Members
  • PipPipPip
  • Advanced Member
  • 81 posts

Posted 29 August 2006 - 02:01 PM

Hi runnerjp,

Try this:

<?php
#################################
include("chatbox/connect.php");
#################################

mysql_connect($host,$dbuser,$dbpass) or die(mysql_error());
// Select the database.
mysql_select_db($dbname) or die(mysql_error());
$query = "SELECT poster, message FROM ch_messages order by id DESC LIMIT 5";
// Otherwise, replace the above line with the following line;
// $query = ("SELECT poster, message FROM ch_messages order by id DESC LIMIT 5");
$result = mysql_query($query);
$marquee = "";
$i = 0;
while($r=mysql_fetch_array($result))
{
   $posts[$i] = $r[poster].' - '. $r[message]. '';
   ++$i;
}
$marquee = implode("<img src='http://www.runnerselite.com/image/runner.gif'>", $posts);

echo "<marquee><font size='3'><span style='color: white'>". $marquee. "</span></font></marquee>";

?>


Regards,
Iceman




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users