Jump to content

Archived

This topic is now archived and is closed to further replies.

runnerjp

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

Recommended Posts

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

[code]<?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][/code]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Missing terminating semi-colon on this line:
[code]<?php $marquee = implode("<img src='http://www.runnerselite.com/image/runner.gif'>", $posts) ?>[/code]

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

Ken

Share this post


Link to post
Share on other sites
ok i did all that u said

[code]<?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]

yet still an error on lien 20 :S

Share this post


Link to post
Share on other sites
still missing the semi-colon at the end of the implode line, not a question mark

Share this post


Link to post
Share on other sites
Hi runnerjp,

Try this:

[code]
<?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>";

?>

[/code]

Regards,
Iceman

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.