Jump to content

error with script :(:(:( is n e 1 good here who can help ??


runnerjp

Recommended Posts

Parse error: syntax error, unexpected T_LOGICAL_OR in /home/runnerse/public_html/chatbox/connect.php on line 5

thats the issue

here is the code

[code]<?php
$host  = "localhost";
$dbuser = "runnerse";
$dbpass = "runnerjp2003";
$dbname = "runnerse_shoutbox"; or die("Could not connect.");
mysql_connect($host,$dbuser,$dbpass) or die(mysql_error());
// Select the database.
mysql_select_db($dbname) or die(mysql_error());



if(!$db)


        die("no db");


if(!mysql_select_db("runnerse_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]
Link to comment
Share on other sites

Change:
$dbname = "runnerse_shoutbox"; or die("Could not connect.");

To:
$dbname = "runnerse_shoutbox" or die("Could not connect.");


You see, the problem was you added a semicolon before the "or die...".
Tho I dont understand how the "or die(...)" part helps you.

Orio.
Link to comment
Share on other sites

the new code looks like this


[code]<?php
$host  = "localhost";
$dbuser = "myusername";
$dbpass = "mypassword";
$dbname = "runnerse_chatbox";
mysql_connect($host,$dbuser,$dbpass) or die("Could not connect: ".mysql_error());
// Select the database.
mysql_select_db($dbname) or die(mysql_error());



if(!$db)


        die("no db");


if(!mysql_select_db("runnerse_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]

yet it still keeps comein up with no db :S

here is marquee to bd if that helps

[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]
Link to comment
Share on other sites

Look at the variable "$db"

[code]
<?php
$host  = "localhost";
$dbuser = "myusername";
$dbpass = "mypassword";
$dbname = "runnerse_chatbox";
mysql_connect($host,$dbuser,$dbpass) or die("Could not connect: ".mysql_error());
// Select the database.
mysql_select_db($dbname) or die(mysql_error());



if(!$db)
  die("no db");
[/code]

You never actually set it to anything in your code.  Change the line:

[code]mysql_connect($host,$dbuser,$dbpass) or die("Could not connect: ".mysql_error());[/code]

To:
[code]$db = mysql_connect($host,$dbuser,$dbpass) or die("Could not connect: ".mysql_error());[/code]

Like Yesideez said in an earlier post.
Link to comment
Share on other sites

ok i know im gonna be a pain in ass but as im on a role i wanna know ... is their a way of separatin the name and message the some space cos at mo if you look [url=http://www.runnerselite.com]www.runnerselite.com[/url] it comes as one lol and could i add a picture like my logo in between each diff comment ??? or is that all 2 hard to do
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.