cameeob2003 Posted July 1, 2006 Share Posted July 1, 2006 I am getting the following error:[quote]Parse error: parse error, unexpected $ in /index.php on line 986[/quote]here are the last lines of my code:[code]<?phpif($_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[/code]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 Quote Link to comment https://forums.phpfreaks.com/topic/13415-getting-an-error-message-supposidly-because-of-my-end-tag/ Share on other sites More sharing options...
mrwhale Posted July 1, 2006 Share Posted July 1, 2006 Is there any php code before that? Quote Link to comment https://forums.phpfreaks.com/topic/13415-getting-an-error-message-supposidly-because-of-my-end-tag/#findComment-51780 Share on other sites More sharing options...
cameeob2003 Posted July 1, 2006 Author Share Posted July 1, 2006 Here is the more of the code (full page is to long to post :():[code]<?phpif($_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>';}?><?phpif($_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>";}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/13415-getting-an-error-message-supposidly-because-of-my-end-tag/#findComment-51790 Share on other sites More sharing options...
cameeob2003 Posted July 1, 2006 Author Share Posted July 1, 2006 Anyone out there. Im realy in need of help to solve this problem. Any help is welcome. Quote Link to comment https://forums.phpfreaks.com/topic/13415-getting-an-error-message-supposidly-because-of-my-end-tag/#findComment-51799 Share on other sites More sharing options...
kals Posted July 2, 2006 Share Posted July 2, 2006 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 ) Quote Link to comment https://forums.phpfreaks.com/topic/13415-getting-an-error-message-supposidly-because-of-my-end-tag/#findComment-51802 Share on other sites More sharing options...
mrwhale Posted July 2, 2006 Share Posted July 2, 2006 [code]$sql = "SELECT * FROM matches order by id";[/code]should be either of these i think?[code]$sql = "SELECT * FROM matches order by id asc";[/code]or[code]$sql = "SELECT * FROM matches order by id desc";[/code]Hope this helps :) Quote Link to comment https://forums.phpfreaks.com/topic/13415-getting-an-error-message-supposidly-because-of-my-end-tag/#findComment-51814 Share on other sites More sharing options...
heckenschutze Posted July 2, 2006 Share Posted July 2, 2006 Just another note, you should be formatting your SQL queries correctly...[code]$sql = "SELECT * FROM `matches` ORDER BY `id` DESC";[/code] Quote Link to comment https://forums.phpfreaks.com/topic/13415-getting-an-error-message-supposidly-because-of-my-end-tag/#findComment-51819 Share on other sites More sharing options...
redarrow Posted July 2, 2006 Share Posted July 2, 2006 I want to see the whole page iam intreged. Quote Link to comment https://forums.phpfreaks.com/topic/13415-getting-an-error-message-supposidly-because-of-my-end-tag/#findComment-51829 Share on other sites More sharing options...
cameeob2003 Posted July 2, 2006 Author Share Posted July 2, 2006 The entire page wont fit into a forum post :( . But I have determined the following is the code that is messing up my page:[code]<?phpif($_GET['page'] == "register_parse"){# include mysql connection scriptinclude("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 againexit();# 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>';}}?>[/code]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. Quote Link to comment https://forums.phpfreaks.com/topic/13415-getting-an-error-message-supposidly-because-of-my-end-tag/#findComment-51870 Share on other sites More sharing options...
redarrow Posted July 2, 2006 Share Posted July 2, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/13415-getting-an-error-message-supposidly-because-of-my-end-tag/#findComment-51873 Share on other sites More sharing options...
Drumminxx Posted July 2, 2006 Share Posted July 2, 2006 your code will never get past the exit()[code]# 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();[/code]its just sitting there being executed everytime Quote Link to comment https://forums.phpfreaks.com/topic/13415-getting-an-error-message-supposidly-because-of-my-end-tag/#findComment-51876 Share on other sites More sharing options...
redarrow Posted July 2, 2006 Share Posted July 2, 2006 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()); Quote Link to comment https://forums.phpfreaks.com/topic/13415-getting-an-error-message-supposidly-because-of-my-end-tag/#findComment-51890 Share on other sites More sharing options...
.josh Posted July 2, 2006 Share Posted July 2, 2006 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 [i]want[/i] 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. Quote Link to comment https://forums.phpfreaks.com/topic/13415-getting-an-error-message-supposidly-because-of-my-end-tag/#findComment-51895 Share on other sites More sharing options...
cameeob2003 Posted July 2, 2006 Author Share Posted July 2, 2006 Here is the link to my full code:[url=http://n2p.ventgaming.com/n2psitecode.txt]http://n2p.ventgaming.com/n2psitecode.txt[/url]I appreciate all the support. Quote Link to comment https://forums.phpfreaks.com/topic/13415-getting-an-error-message-supposidly-because-of-my-end-tag/#findComment-51901 Share on other sites More sharing options...
.josh Posted July 2, 2006 Share Posted July 2, 2006 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:[code] // 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/> '; }[/code]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. Quote Link to comment https://forums.phpfreaks.com/topic/13415-getting-an-error-message-supposidly-because-of-my-end-tag/#findComment-51917 Share on other sites More sharing options...
cameeob2003 Posted July 2, 2006 Author Share Posted July 2, 2006 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:[quote]Parse error: parse error, unexpected $ in /homepages/34/d154144477/htdocs/ventgaming/n2p/index.php on line 955[/quote]here is a link to the updated code (same link as before):[url=http://n2p.ventgaming.com/n2psitecode.txt]http://n2p.ventgaming.com/n2psitecode.txt[/url] Quote Link to comment https://forums.phpfreaks.com/topic/13415-getting-an-error-message-supposidly-because-of-my-end-tag/#findComment-52000 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.