Page 1 of 1

Parse error: syntax error, unexpected T_VARIABLE

Posted: Thu Jun 28, 2012 3:13 am
by 2ndstagesasuke
Everytime i try to go to the page it says Parse error: syntax error, unexpected T_VARIABLE (for user profile) here's the intl script script:
<?php

// fetches all of the users from the tabe.
function fetch_users(){
	$result = mysql_query('SELECT `id` AS `id`, `username` AS `username` FROM `forums_users`');

	$users = array();
	
	while (($row =  mysql_fetch_assoc($result)) !== false){
		$users[] = $row;
	}
	
	return $users;
}

// fetches profile information for the given user.
fuction fetch_user_info($uid){
	$uid = (int)$uid;
	
	$sql - "SELECT
				`username` AS `username`
				`email` AS `email`
				`gender` AS `gender`
			FROM `users`
			WHERE `id` - {$uid}";
			$result = mysql_query($sql);
			
			return mysql_fetch_assoc($result);
}
?>
and the main one
<?php

include('/inti.inc.php')

$user_info - fetch_user_info($_GET['uid']);
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Kenchi Forums - The Officlal Kenchi Kageotra Clan Forum</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="http://forum.kenchikagetora.x10.mx/imag ... avicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="" />
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript" src="http://cdn.jquerytools.org/1.2.6/full/j ... "></script>
<link href="http://www.forum.kenchikagetora.x10.mx/ ... newone.css" rel="stylesheet" type="text/css" />
 <include 'msql_connect.php';/>
</head>
<body><br class="clear" />
<div id="maincontainer">
<div id="top">
<div class="topblock">
<div>
<form method="post" action="/process"><input type="hidden" name="sublogin" value="1" /><input type="text" size="16" name="user" onfocus="if (this.value=='Username') this.value=''" onblur="if (this.value=='') this.value='Username'" value="Username" class="login" /><br />
<input type="password" size="16" name="pass" onfocus="if (this.value=='Password') this.value=''" onblur="if (this.value=='') this.value='Password'" value="Password" class="login" /><br />
<input type="submit" class="buttonone" value="Login" />
<button onclick="location.href='/register/'" class="buttonone" type="button">Register</button><input type="checkbox" checked="checked" value="yes" name="remember" id="cookie" /><label class="remember" for="cookie">Remember</label></form></div></div>
<div class="topblock">
<div>
<h3>Latest Posts</h3></div></div>
<div class="topblock">
<div>
<h3>Latest Topics</h3></div></div>
 <div id="breadcrumb"><span class="headtext"><a class="specialfont" href="/">Forums</a></span></div>
<div class="padding_b"></div>
<div class="contentmiddle">
 Welcome to the Kenchi Kagetora Clan Forums. If this is your first time visiting the forums, make sure to read the forum rules before posting. Note that you have to <a href="/register" class="con lowercase">Register</a> an account before you are able to post. 
<br/><br/>
<div class="header"><h3>Account information</h3></div>
	<table class="profileinfo">
		<tr>
			<td><u>Username:</u> <h4></h4></td>
			<td rowspan="9" class="profile_avatar">
				<img style="min-height: 75px; min-width: 75px; max-height: 75px; max-width: 75px;" src="/images/avatars/107.jpg" alt="" />
<div>
				</div>
			</td>
		</tr>
		<tr>
			<td><u>User-ID:</u></td>
		</tr>
		<tr>
			<td><u>Site rank:</u></td>
		</tr>
		<tr>
			<td><u>Forum rank:</u></td>
		</tr>
		<tr>
			<td><u>Posts:</u> 4</td>
		</tr>
		<tr>
			<td><u>E-mail:</u></td>
		</tr>
		<tr>
			<td><u>Status:</u>
		</tr>
		<tr>
			<td><u>Last seen online:</u></td>

		</tr>
		<tr>
			<td><u>Latest page activity:</u>
							</td>
		</tr>
		<tr>
			<td><u>Registered on:</u></td>

		</tr>
		</table>
	
		
	<div class="header"><h3>Other information</h3></div>
	<table class="profileinfo">
		<tr>
			<td>
				<u>N-A Userame:</u></a>			</td>
			<td>
				<u>E-Birthday:</u> 		</td>
		</tr>
		<tr>
			<td>
				<u>S-A Userame:</u> 			</td>
			<td>
				<u>Gender:</u> 			</td>
		</tr>
		<tr>
			<td>
				<u>WoN Username:</u>			</td>
			<td>
				<u>Country:</u> </div>			</td>
		</tr>
		<tr>
			<td>
				<u>Website:</u>			</td>
			<td>
				<u>MSN E-mail:</u> <div class="nothing">n/a</div>			</td>
		</tr>
	</table>

	
	<div class="header"><h3>Arcade games statistics</h3></div>
	<table class="profileinfo">
		<tr>
			<td>
				<u>Arcade rank:</u>	</td>
			<td>
				<u>Titles:</u>	</td>
		</tr>
		<tr>
			<td>
				<u>Most played game:</td>
			<td>
				<u>Total game score submits:</u></td>
		</tr>
	</table>	
		
		
		
		<div class="header"><h3>Forum signature</h3></div>
	<table class="profileinfo">
		<tr>
			<td>
				
			</td>
		</tr>
	</table>


				<div id="onusers">Users online</div><br />
</div>
<div id=""></div>
<div id="onlinetop"></div>
<div id="online">
<div>
						There are currently no user online, comeback later and see if there are any! ~ <font class="rank5">Oreo</font> your beloved Webmaster.</div>
<div>
<div class="fleft"></div><br class="clear" />
</div></div>
<div id="onlinebottom">
<div> <font class="rank5">Webmasters:</font> 0 - <font class="rank4">Admins:</font> 0 - <font class="rank3">Global Moderators:</font> 0 - <font class="rank2">Moderators:</font> 0 - <font class="rank1">Members:</font> 0 - <font class="rank0">Guests:</font> 0 </div></div>
<div id="copyright"> © Copyright 2012-2013, <span class="specialfont">Kenchi clan forums</span>. All rights reserved. </div></div></div>
</body>
</html>
<script>
$(function() {
	$("#bottombuttons").tabs("#online > div");
});
</script>

Re: Parse error: syntax error, unexpected T_VARIABLE

Posted: Thu Jun 28, 2012 12:27 pm
by jacek
You're not ending your php block before the HTML starts, so
    <?php
     
    include('/inti.inc.php')
     
    $user_info - fetch_user_info($_GET['uid']);
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
should be
    <?php
     
    include('/inti.inc.php')
     
    $user_info - fetch_user_info($_GET['uid']);
    
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
If that doesn't sort it can you post the full error message ?

Re: Parse error: syntax error, unexpected T_VARIABLE

Posted: Thu Jun 28, 2012 7:14 pm
by 2ndstagesasuke
It still says Parse error: syntax error, unexpected T_VARIABLE in /home/kenchika/public_html/user/index.php on line 5

Re: Parse error: syntax error, unexpected T_VARIABLE

Posted: Fri Jun 29, 2012 12:51 pm
by jacek
2ndstagesasuke wrote:It still says Parse error: syntax error, unexpected T_VARIABLE in /home/kenchika/public_html/user/index.php on line 5
No ; at the end of the include line ?

Re: Parse error: syntax error, unexpected T_VARIABLE

Posted: Sat Jun 30, 2012 3:47 am
by 2ndstagesasuke
that worked, now it says Fatal error: Call to undefined function fetch_user_info() in /home/kenchika/public_html/user/index.php on line 5

Re: Parse error: syntax error, unexpected T_VARIABLE

Posted: Sat Jun 30, 2012 12:48 pm
by jacek
2ndstagesasuke wrote:that worked, now it says Fatal error: Call to undefined function fetch_user_info() in /home/kenchika/public_html/user/index.php on line 5
Well, where is that function being defined ? You need to make sure the correct file is being included.