PDA

View Full Version : Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING


Morf
05-09-2006, 10:35 AM
Hi!

New to php, so please bear with me:

I'm having some trouble with the following, here's the error I'm receiving:

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/gangste1/public_html/registration.php on line 7


Here's the code starting from line 5, the third line is my problem line:


$sql = "INSERT INTO `memberdirectory` ( `sid`, `lname`, `fname`, `IP`, `date`, `nick` , `referrer` , `updated` , `email` , `password` )
VALUES(0,'$lname','$fname','Unknown',NOW(),'$nickname','1','Y','$email','$password')
mysql_query($sql);


In addition, how can I 'catch' the IP address of the visitor and insert it into this query?

Appreciated. :thumbsup:

GJay
05-09-2006, 11:10 AM
missing quotes off the query...

Morf
05-09-2006, 11:26 AM
hmmn think i found it...

Morf
05-09-2006, 12:08 PM
Thanks for your help.

I did insert the quote to end the query, however now it is saying:

Parse error: parse error, unexpected T_STRING in /home/gangste1/public_html/registration.php on line 6

Here is the new code starting from line 5:


$sql="INSERT INTO 'memberdirectory' ( `sid`, `lname`, `fname`, `IP`, `date`, `nick`
,`referrer`,`updated`,`email`,`password`)
VALUES (0,'$lname','$fname','Unknown',NOW(),'$nickname','1','Y','$email','$password')"

GJay
05-09-2006, 12:19 PM
and the semi-colon?

Morf
05-09-2006, 12:33 PM
and the semi-colon?

BAM yes! Thanks! First php program ever complete.

degsy
05-09-2006, 01:28 PM
IP = http://uk2.php.net/manual/en/function.getenv.php#32498