Page 1 of 1

Help me: PHP Parse error

Posted: Thu Jun 26, 2003 8:20 pm
by wugang_bob
Source code is

1)?php
2)include('connect.php');
3)mysql_select_db("$table_name1");
4)$query = "select * from userid where username="$_REQUEST[username]";


The error message is:
PHP Parse error: parse error, unexpected T_VARIABLE in e:\inetpub\wwwroot\yuan\adduser1.php on line 4

Thank you

Bob

Posted: Thu Jun 26, 2003 8:48 pm
by trollll
Try replacing line 4 with:

Code: Select all

$query = "select * from userid where username=".$_REQUEST[username];
The "." appends strings together so that:
"Hello"." "."world." would return "Hello world."

Posted: Fri Jun 27, 2003 3:21 am
by Wayne

Code: Select all

4)$query = "select * from userid where username="$_REQUESTїusername]";
should be

Code: Select all

4)$query = "select * from userid where username='" . $_REQUESTї'username'] . "'";