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