Home   News  Product reviews  Website reviews  Forums   Competitions  Subscribe 


Web Building >> Web design & build
 |  Print Topic
Jump to first unread post. Pages: 1
Terborch
regular


Reg'd: Thu
Posts: 29
PHP Login Script
      #328348 - Wed Jan 24 2007 01:13 AM

Anyone know anything about php signup & login scripts? I have one and modified it to work on my site. When I tried out the signup part of it, it gave me this message:
Quote:

Parse error: syntax error, unexpected T_STRING in signup.php on line 41



Heres the line it's talking about:
Quote:

VALUES ('".$_POST['username']."', '".$_POST['pass']."')";



Heres the lines above and below that one to give you a better idea of what its reading:
Quote:

// now we insert it into the database $insert = "INSERT INTO users (username, password)
VALUES ('".$_POST['username']."', '".$_POST['pass']."')";
$add_member = mysql_query($insert);
?>



What did I miss & how do I fix it?


Post Extras: Print Post   Remind Me!   Notify Moderator  
ianm
regular


Reg'd: Fri
Posts: 347
Loc: Colchester
Re: PHP Login Script [Re: Terborch]
      #328517 - Wed Jan 24 2007 09:14 PM

I am no expert but I would look at the quotes in the string thats what the error is pointing clues at, I can see a problem with the concatenation as you dont need the . at the start of $_POST or at the end of you final post array. Try something like this:

VALUES ($_POST['username'].', '.$_POST['pass']);

Also just to see if the variables you are trying to get the values of are holding any data you could try the following to test with:

echo 'username holds ' . $username . '<br />';
echo 'pass holds ' . $pass;

Cheers


Post Extras: Print Post   Remind Me!   Notify Moderator  
Zippy_Brown
regular


Reg'd: Fri
Posts: 88
Loc: /dev/null
Re: PHP Login Script [Re: Terborch]
      #328534 - Wed Jan 24 2007 10:24 PM

Quote:


// now we insert it into the database $insert = "INSERT INTO users (username, password)
VALUES ('".$_POST['username']."', '".$_POST['pass']."')";
$add_member = mysql_query($insert);
?>





The // are comment marks, but the comment has part of the next line of code in it. Split the comment and the code apart again by creating a new line after the word database, so it reads:

Quote:


// now we insert it into the database
$insert = "INSERT INTO users (username, password)
VALUES ('".$_POST['username']."', '".$_POST['pass']."')";
$add_member = mysql_query($insert);
?>





--------------------
Zippy


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1

Rate this topic

Jump to


Extra information
0 registered and 0 anonymous users are browsing this forum.

Moderator:  putasolutions, Joe_London, greysts, bricat, Nanook, Hello_There, John_McKenna, Mouse, TheFatControlleR 


Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      Mark-up is enabled

Rating:
Topic views: 0

Contact Us | Privacy statement Main website