Jump to content


Photo

Getting an error message supposidly because of my ?> end tag.


  • Please log in to reply
15 replies to this topic

#1 cameeob2003

cameeob2003
  • Members
  • PipPipPip
  • Advanced Member
  • 79 posts

Posted 01 July 2006 - 09:43 PM

I am getting the following error:

Parse error: parse error, unexpected $ in /index.php on line 986


here are the last lines of my code:

<?php
if($_GET['page'] == "incomplete"){
	session_start();
	header("Cache-control: private");
	$username = $_SESSION['username'];
	
	echo "<font id=NewsText />This page is not yet finished. We are working on the development<br/> 
	of the rest of the site. Please contact you local webmaster for more info.<br/>
	</font>";
}
?> // <-- line 986

Im not sure why it is saying this I have looked over it and tryed several different things but none successfull. Any help is great. Thnx

#2 mrwhale

mrwhale
  • Members
  • PipPipPip
  • Advanced Member
  • 42 posts

Posted 01 July 2006 - 10:17 PM

Is there any php code before that?

#3 cameeob2003

cameeob2003
  • Members
  • PipPipPip
  • Advanced Member
  • 79 posts

Posted 01 July 2006 - 10:55 PM

Here is the more of the code (full page is to long to post :():

<?php
if($_GET['page'] == "matches"){
	session_start();
	header("Cache-control: private");
	$username = $_SESSION['username'];
	
	# Database connect script
	# You can edit the next four lines

	$db_host = 'your_host';
	$db_user = 'username';
	$db_pass = 'your_pass';
	$db_name = 'your_db_name';

	# Under here DONT TOUCH!!!
	$connection = mysql_pconnect("$db_host","$db_user","$db_pass")
	or die("Couldn't connect to server.");
	$db = mysql_select_db("$db_name", $connection)
	or die("Couldn't select database");
	
	echo ' 
	<table>
	<tr>
	<td bgcolor="#CCCCCC">ID</td>
	<td bgcolor="#CCCCCC">Team 1</td>
	<td bgcolor="#CCCCCC">___</td>
	<td bgcolor="#CCCCCC">Team 2</td>
	<td bgcolor="#CCCCCC" align="center" valign="middle">Match Highlights</td>
	<td bgcolor="#CCCCCC">Final Score</td>
	<td bgcolor="#CCCCCC">Date</td>
	</tr>';
	
	
	$sql = "SELECT * FROM matches order by id";
	$query = mysql_query($sql);
	while($row = mysql_fetch_array($query)) {
	$id = $row['id'];
	$team1 = $row['home_team'];
	$team2 = $row['away_team'];
	$team1_webs = $row['team1_web'];
	$team2_webs = $row['team2_web'];
	$score1 = $row['score_one'];
	$score2 = $row['score_two'];
	$date = $row['date_played'];
   	}
	echo '
	<tr>
	<td bgcolor="#CCCCCC"><font id=dash>$id</font></td>
	<td bgcolor="#CCCCCC" width="10">___</td>
	<td bgcolor="#CCCCCC">
	<a href="$team1_webs"><font id=ttext />$team1</font></a></td>
	<td bgcolor="#CCCCCC"><font id=dash />vs</font></td>
	<td bgcolor="#CCCCCC"><a href="$team2_webs"><font id=cttext />$team2</font></a></td>
	<td bgcolor="#CCCCCC" width="100" align="center" valign="center"><font id=dash /><a href="?page=matches=$id">view match highlights</font></a></td>
	<td bgcolor="#CCCCCC"><font id=ttext />$score1</font><font id=dash />-</font><font id=cttext />$score2</font></td>
	<td bgcolor="#CCCCCC"><font id=dash />$date</font></td>
	</tr>';
}
?>

<?php
if($_GET['page'] == "incomplete"){
	session_start();
	header("Cache-control: private");
	$username = $_SESSION['username'];
	
	echo "<font id=NewsText />This page is not yet finished. We are working on the development<br/> 
	of the rest of the site. Please contact you local webmaster for more info.<br/>
	</font>";
}
?>


#4 cameeob2003

cameeob2003
  • Members
  • PipPipPip
  • Advanced Member
  • 79 posts

Posted 01 July 2006 - 11:35 PM

Anyone out there. Im realy in need of help to solve this problem. Any help is welcome.

#5 kals

kals
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 02 July 2006 - 12:17 AM

I encountered this problem many times and its ussually because a qoute " or a } is missing what I normally do is move blocks of code to a temprory file until the error dissapears and then check the last block I moved.
such a problem can't be found without seeing entire code (also try looking at the code in some php editing software that shows colour coded php tags )


#6 mrwhale

mrwhale
  • Members
  • PipPipPip
  • Advanced Member
  • 42 posts

Posted 02 July 2006 - 01:01 AM

$sql = "SELECT * FROM matches order by id";

should be either of these i think?

$sql = "SELECT * FROM matches order by id asc";

or

$sql = "SELECT * FROM matches order by id desc";


Hope this helps :)

#7 heckenschutze

heckenschutze
  • Members
  • PipPipPip
  • Advanced Member
  • 257 posts
  • LocationAustralia

Posted 02 July 2006 - 01:10 AM

Just another note, you should be formatting your SQL queries correctly...

$sql = "SELECT * FROM `matches` ORDER BY `id` DESC";


#8 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 02 July 2006 - 03:19 AM

I want to see the whole page iam intreged.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#9 cameeob2003

cameeob2003
  • Members
  • PipPipPip
  • Advanced Member
  • 79 posts

Posted 02 July 2006 - 05:18 AM

The entire page wont fit into a forum post :(  . But I have determined the following is the code that is messing up my page:

<?php
if($_GET['page'] == "register_parse"){

# include mysql connection script
include("db.php");

# Grab the post variables from the PHP form
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$email_address = $_POST['email_address'];
$username = $_POST['username'];
$bio = $_POST['bio'];

# Checking for anything that could cause errors
$first_name = stripslashes($first_name);
$last_name = stripslashes($last_name);
$email_address = stripslashes($email_address);
$username = stripslashes($username);
$bio = stripslashes($bio);

# Any errors in the posted fields? Lets check...
if((!$first_name) || (!$last_name) || (!$email_address) || (!$username)){
	echo '<font id=NewsText />You did not submit the following required information! <br/></font>';
}
if(!$first_name){
	echo '<font id=NewsText />First name is a required field. Please enter it below. <br/></font>';
}
if(!$last_name){
	echo '<font id=NewsText />Last name is a required field. Please enter it below. <br/></font>';
}
if(!$email_address){
	echo '<font id=NewsText />Email address is a required field. Please enter it below. <br/></font>';
}
if(!$username){
	echo '<font id=NewsText />Username is a required field. Please enter it below. <br/></font>';
}
include("?page=register");
exit();

# does this username already exist in the database? lets check for that now...
$sql_email_check = mysql_query("SELECT email FROM users WHERE email='$email'");
$sql_username_check = mysql_query("SELECT username FROM users username='$username'");

$email_check = mysql_num_rows($sql_email_check);
$username_check = mysql_num_rows($sql_username_check);

if(($email_check > 0) || ($username_check > 0)){
	echo '<font id=NewsText />Please fix the following errors: <br/></font>';
	if($email_check > 0){
		echo '<font id=NewsText />Your email address has already been used by another member in our database. Please use a different Email address!<br/></font>';
	unset($email_address);
}
if($username_check > 0){
	echo '<font id=NewsText />The username you have selected has already been used by another member in our database. Please choose a different Username!<br/></font>';
	unset($username);
}
include("?page=register"); // Show form again
exit();

# everything checks out so far, so lets add the user!
function makeRandomPassword(){
 $salt = "abcdefghijklmnopqrstuvwxyz0123456789";
 srand((double)microtime()*1000000);
  $i = 0;
  while ($i <= 7){
  	$num = rand() % 33;
	$tmp = substr($salt, $num, 1);
	$pass = $pass .$tmp;
	$i++;
}
return $pass;
}

$random_password = makeRandomPassword();

$db_password = md5($random_password);

# Enter into database

$info2 = htmlspecialchars($info);
$sql = mysql_query("INSERT INTO users (first_name, last_name, email, username, password, encryptpass, bio, signup_date) VALUES('$first_name','$last_name','$email','$username','$db_password','$info2', now(),'$random_password')") or die (mysql_error());

if(!$sql){
	echo '<font id=NewsText />There has been an error creating your account. Please contact the webmaster.</font>';
}else{
	$userid = mysql_insert_id();
	// Let's mial the user!
	$subject = "Your Membership at n2p.com";
	$message = "Dear $first_name $last_name,
	You are now registered at our website, http://www.n2p.com!
	
	To activate your membership, please login here: http://www.n2p.com/index.php?=login_form
	
	Once you activate your membership, you will be able to login with the following information:
	Username: $username
	Password: $random_password
	Please keep this username and password in a location that is easily accessible by you.
	
	Thanks!
	Webmaster, n2p.com
	
	This is an automated response, please do not reply!";
	
mail($email_address, $subject, $message, "From: n2p.com<webmaster@n2p.com>\nX-Mailer: PHP/" . phpversion());
	echo '<font id=NewsText />Your membership information has been mailed to $email_address ! Please check it and follow the directions!</font>';
}
}
?>

I went over the code in order to fix the problem yet im still getting the error. I think it would make sence i didn't end a strand right but what strand would that be. As I said im new to PHP but I gave it a look over to make sure that It wasnt some little missing end tag and there was nothing I had seen (although im realy tired and my eyes hurt). Anyway if someone could tell me what I have done wrong in this code that would be great. Thnx in advance.

#10 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 02 July 2006 - 05:31 AM

for a start i would use an include this way.

include("whatever.php");

and the cheek statement can be conbined togeter ok.

example only.

$sql_email_check = mysql_query("SELECT users.email,users.username FROM users WHERE
username=$username and email='$email'");

$result=mysql_query($sql_email_check);

if(mysql_num_rows($result) > 0) {

echo" sorry but email or username exist please use another";

}


also in your database you got insert a now() i nerver seen that before what that for?
also anyone else tell me cheers.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#11 Drumminxx

Drumminxx
  • Members
  • PipPipPip
  • Advanced Member
  • 92 posts
  • LocationUSA

Posted 02 July 2006 - 05:45 AM

your code will never get past the exit()

# Any errors in the posted fields? Lets check...
if((!$first_name) || (!$last_name) || (!$email_address) || (!$username)){
	echo '<font id=NewsText />You did not submit the following required information! <br/></font>';
}
if(!$first_name){
	echo '<font id=NewsText />First name is a required field. Please enter it below. <br/></font>';
}
if(!$last_name){
	echo '<font id=NewsText />Last name is a required field. Please enter it below. <br/></font>';
}
if(!$email_address){
	echo '<font id=NewsText />Email address is a required field. Please enter it below. <br/></font>';
}
if(!$username){
	echo '<font id=NewsText />Username is a required field. Please enter it below. <br/></font>';
}
include("?page=register");
exit();


its just sitting there being executed everytime
:: gucci.com ::
:: blockbuster.com ::

--------------------

#12 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 02 July 2006 - 06:21 AM

also as advised from another user the random_password was missing ok.

Also take the exit; away as advised.

This is the correct code if the signup_date has a timestamp in the database



$sql = mysql_query("INSERT INTO users (first_name, last_name, email, username, password,bio, signup_date,random_password') VALUES('$first_name','$last_name','$email','$username','$db_password','$info2',NOW(),'$random_password')") or die (mysql_error());

or use this

$signup_date($_POST(['signup_date']));
$signup_date=date("d:m:y");

$sql = mysql_query("INSERT INTO users (first_name, last_name, email, username, password, bio, signup_date,random_password') VALUES('$first_name','$last_name','$email','$username','$db_password','$info2','$signup_date','$random_password')") or die (mysql_error());
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#13 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 02 July 2006 - 06:35 AM

you said that there is more code than that, but you couldn't fit it all there? can you make a linkie for it then? cuz even though your code won't work the way you want to work (see above posts), there is no syntatical errors in the code you provided. So the syntax error you are getting is not there.  i suspect your problem may be in your include statements though.  you are including the same file, only with a specific variable being passed. well this still includes the entire file, tags and all.
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#14 cameeob2003

cameeob2003
  • Members
  • PipPipPip
  • Advanced Member
  • 79 posts

Posted 02 July 2006 - 07:45 AM

Here is the link to my full code:

http://n2p.ventgamin...n2psitecode.txt

I appreciate all the support.

#15 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 02 July 2006 - 08:39 AM

okay, i think i found your problem.

first off, you have some other miscelaneous bugs, like, missing ; after your exit()'s and an extra } towards the end.  people already mentioned this, but the code you provided in your link still shows it.

2nd, down around line 221:

	// preform actions according to users access level
	if($access == "0"){
  echo '<font id=UserNameRed />Please login</font><br/>
		<font id=NewsText />Not a member? To register <a href=?page=register target="ifram2">click here</font></a><br/> 
		';
	}
you are not using your quotes correctly. therefore the echo statement is never closed, so all of those other if statements after that, all the way down to your closing ?> is treated as part of the echo. this may or may not be the root of your problem, but it should bring you closer to your solution.
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#16 cameeob2003

cameeob2003
  • Members
  • PipPipPip
  • Advanced Member
  • 79 posts

Posted 02 July 2006 - 02:56 PM

I updated the code a little bit tryed to get most of the things you guys told me to fix fixed yet im not sure I did correctly on the echo lines but im working on it. Well after I updated the code and tryed to make the improvements I still get the:

Parse error: parse error, unexpected $ in /homepages/34/d154144477/htdocs/ventgaming/n2p/index.php on line 955


here is a link to the updated code (same link as before):
http://n2p.ventgamin...n2psitecode.txt




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users