Jump to content

Archived

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

runnerjp

help i keep gettin error message :(

Recommended Posts

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

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

Share this post


Link to post
Share on other sites
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
[code]<?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);


}


?>[/code]

now my new maq

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

Share this post


Link to post
Share on other sites
????

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

Share this post


Link to post
Share on other sites
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());

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.