Jump to content

Php T_STRING Help


juelpatwary

Recommended Posts

Hi, Ive been making a website but i get this error in index.php, Ive tried for ages, But i just figure it out, I am guessing its realy simple but i cant do It  :-[ So i turned to you! Google was my friend and found the best PHP help site out there,So please can you help me

 

This is what it says on the website 

 

Parse error: syntax error, unexpected T_STRING in /home/a6331818/public_html/index.php on line 7

 

And in the file index.php it says this

 

$chandle = mysql_connect("localhost", $dbuser, $dbpass)

 

So?... Any help please and thankyou,

 

Regards

Link to comment
https://forums.phpfreaks.com/topic/93153-php-t_string-help/
Share on other sites

Okey thanks for the fast replys  ;D And ill try it now

 

Argh! no it says this now

 

Parse error: syntax error, unexpected T_VARIABLE in /home/a6331818/public_html/index.php on line 7

 

 

Heres some of the code (It wont let me post all the code)

 

<?php

$time = time();

$time15 = time() + (15 * 60);

session_start();

$dbuser="a6331818_rs2";

$dbpass="randomalfie111"

$dbname = "a6331818_rs2";

$chandle = mysql_connect("localhost", $dbuser, $dbpass);

or die("Connection Failure to Database");

mysql_select_db($dbname, $chandle) or die ($dbname . " Database not found." . $dbuser);

$playerClan = 0;

$playerId = -1;

$mysql = mysql_query("SELECT * FROM uber3_players where name='".$username."' and pass='".$password."' LIMIT 1") or die(mysql_error());

while($row = mysql_fetch_assoc($mysql)){

$playerId = $row['id'];

$playerClan = $row['ClanID'];

}

function loggedIn() {

if(isset($_SESSION['username'])) {

$username = $_SESSION['username'];

$password = $_SESSION['password'];

$mysql = mysql_query("SELECT * FROM uber3_players where name='".$username."' and pass='".$password."' LIMIT 1") or die(mysql_error());

$destroy = true;

while($row = mysql_fetch_assoc($mysql)){

$_SESSION['dbid'] = $row['id'];

        $_SESSION['mgroup'] = $row['mgroup'];

$destroy  = false;

}

if($destroy) {

echo 'Your password has changed. You must relogin.';

session_destroy();

return false;

}

echo $playerClan;

return true;

} else {

echo 'Welcome guest, please <a href="index.php?action=login">Login</a> or <a href="index.php?action=newchar">Register</a>.';

}

return false;

}

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html xmlns:ie="">

<head>

 

Edit: sorry i meant to of pressed edit, I pressed quote sorry

Link to comment
https://forums.phpfreaks.com/topic/93153-php-t_string-help/#findComment-477247
Share on other sites

Get rid of the semi-colon after your $chandle variable.  You can't seperate functions from "or die()" with a semi-colon.

 

This is all pretty elementary.  If you keep getting errors based on your syntax I'd recommend looking over some introductory tutorials.  It's unnecessary to post every syntax error you get on these forums when they're all pretty much the same.  Be careful with your semi-colons.

Link to comment
https://forums.phpfreaks.com/topic/93153-php-t_string-help/#findComment-477270
Share on other sites

Archived

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

×
×
  • 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.