stikky Posted October 15, 2006 Share Posted October 15, 2006 Parse error: syntax error, unexpected T_STRING in /home/thecy3/public_html/test/login/enterdata.php on line 29thats the message i get from the following code when i try to 'register' on this login system i am trying to make for a friend. i have checked all sorts of forums etc, so i realise that it's probably something stupid like a missing quote or bracket, but i just can't find it. if i comment out that line and eveything after it, and do "echo $login", everything works just as expected...so there must be something wrong with the line if ($login == "location:firstPage.php") {what the heck can it be?oh, and btw, obviously i havn't been able to check what comes after that, so please don't laugh if it's awful...!"problem.php"<?php session_start(); $_SESSION['username'] = $_POST['name']; $_SESSION['password'] = $_POST['word']; $name = $_SESSION['username']; $word = $_SESSION['password']; $host = "localhost"; $account = "xxxxxxx"; $password = "xxxxxxx"; $dbname = "xxxxxxx";$connect = mysql_connect($host,$account,$password) or die ('I cannot connect to the database because: ' . mysql_error());mysql_select_db($dbname) or die ('I cannot select the database because: ' . mysql_error());$sql = "SELECT * FROM users";$result = mysql_query($sql,$connect) or die ('I cannot query the database because: ' . mysql_error());$num = mysql_num_rows($result) or die ('I cannot count the rows because: ' . mysql_error());$i=0;while ($i < $num) {$row = mysql_fetch_array($result) or die ('I cannot fetch the array because: ' . mysql_error());if ($row[0] == $name) { $login = "location:register.php"; }else { $login = "location:firstPage.php"; }$i++;}if ($login == "location:firstPage.php") { INSERT INTO users ( 'username' , 'password' , 'date' , 'ip' ) VALUES ('$name', '$word', '', '') or die ('I cannot select insert data to the database because: ' . mysql_error());}else { $_SESSION['samename'] = "yes";}header($login);exit();?> ??? Quote Link to comment https://forums.phpfreaks.com/topic/24027-parse-error-in-registration-page/ Share on other sites More sharing options...
fenway Posted October 15, 2006 Share Posted October 15, 2006 Yeah, the line after that is just "there" ... where's the string? Quote Link to comment https://forums.phpfreaks.com/topic/24027-parse-error-in-registration-page/#findComment-109178 Share on other sites More sharing options...
stikky Posted October 16, 2006 Author Share Posted October 16, 2006 sorry, i don't understand what you mean. it's supposed to compare $login with the string "location:firstPage.php", and then go on to enter the data to the database if that is so, etc. do you mean the problem is with the code that is supposed to enter the data? i did wonder whether i needed to tell it to contact the DB etc etc all over again first. :-[ Quote Link to comment https://forums.phpfreaks.com/topic/24027-parse-error-in-registration-page/#findComment-109755 Share on other sites More sharing options...
fenway Posted October 17, 2006 Share Posted October 17, 2006 Do you not see the floating characters?[code]if ($login == "location:firstPage.php") { INSERT INTO users ( 'username' , 'password' , 'date' , 'ip' ) VALUES ('$name', '$word', '', '') or die ('I cannot select insert data to the database because: ' . mysql_error());[/code] Quote Link to comment https://forums.phpfreaks.com/topic/24027-parse-error-in-registration-page/#findComment-110095 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.