Jump to content


Photo

parse error in registration page?


  • Please log in to reply
3 replies to this topic

#1 stikky

stikky
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 15 October 2006 - 09:09 PM

Parse error: syntax error, unexpected T_STRING in /home/thecy3/public_html/test/login/enterdata.php on line 29

thats 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();
?>
???

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 15 October 2006 - 09:33 PM

Yeah, the line after that is just "there" ... where's the string?
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#3 stikky

stikky
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 16 October 2006 - 10:02 PM

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



#4 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 17 October 2006 - 03:43 PM

Do you not see the floating characters?
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());

Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users