Jump to content

parse error in registration page?


stikky

Recommended Posts

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();
?>
???
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.