Jump to content


Photo

help i keep gettin error message :(


  • Please log in to reply
7 replies to this topic

#1 runnerjp

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

Posted 21 August 2006 - 10:10 AM

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

<?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 = "";
while($r=mysql_fetch_array($result))
{
   $marquee.= $r[poster]. ''. $r[message]. '</a>'";
}
echo "<marquee><font size='3'>". $marquee. "</font></marquee>";
?>


#2 ItsWesYo

ItsWesYo
  • Members
  • PipPipPip
  • Advanced Member
  • 110 posts

Posted 21 August 2006 - 10:18 AM

Well... one thing is for sure ... you mispelled 'marquee' on line 16.

#3 runnerjp

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

Posted 21 August 2006 - 10:21 AM

still duin it

#4 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 21 August 2006 - 10:44 AM

the " on the end of the line in your while loop!!!!! delete it.
follow me on twitter @PHPsycho

#5 runnerjp

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

Posted 21 August 2006 - 10:57 AM

sweet nice 1 thats done.....now i got error on line 7!!!!!
this usuall never happens lol

i will post my connect script as well just incase its a link thing

1st my connect script
<?php


$host   = "localhost";
$dbuser = "my user name to db is here";
$dbpass = "this is where i have typed my pass";
$dbname = "my db name is here"; or die("Could not connect.");


if(!$db)


        die("no db");


if(!mysql_select_db("this is where i have added my db name for my chatbox",$db))


         die("No database selected.");


if(!get_magic_quotes_gpc())


{


  $_GET = array_map('mysql_real_escape_string', $_GET);


  $_POST = array_map('mysql_real_escape_string', $_POST);


  $_COOKIE = array_map('mysql_real_escape_string', $_COOKIE);


}


else


{


   $_GET = array_map('stripslashes', $_GET);


   $_POST = array_map('stripslashes', $_POST);


   $_COOKIE = array_map('stripslashes', $_COOKIE);


   $_GET = array_map('mysql_real_escape_string', $_GET);


   $_POST = array_map('mysql_real_escape_string', $_POST);


   $_COOKIE = array_map('mysql_real_escape_string', $_COOKIE);


}


?>

now my new maq

<?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 = "";
while($r=mysql_fetch_array($result))
{
   $marquee.= $r[poster]. ''. $r[message]. '</a>';
}
echo "<marquee><font size='3'>". $marquee. "</font></marquee>";
?>



#6 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 21 August 2006 - 11:03 AM

????

you are checking in your 1st connect script for a connection that isn't established until you leave the connect script!
stick

mysql_connect($host,$dbuser,$dbpass) or die(mysql_error());
// Select the database.
mysql_select_db($dbname) or die(mysql_error());

straight after

$host  = "localhost";
$dbuser = "my user name to db is here";
$dbpass = "this is where i have typed my pass";
$dbname = "my db name is here"; or die("Could not connect.");

in your connect script
follow me on twitter @PHPsycho

#7 runnerjp

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

Posted 21 August 2006 - 11:06 AM

thanks i did that yet their still seems to be a problem on line 7 :S

#8 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 21 August 2006 - 11:10 AM

what is on line 7?

plus yous should create the resource handle...

have

$conn = mysql_connect($host,$dbuser,$dbpass) or die(mysql_error());
// Select the database.
$db = mysql_select_db($dbname) or die(mysql_error());
follow me on twitter @PHPsycho




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users