Help me: PHP Parse error

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
wugang_bob
Forum Newbie
Posts: 6
Joined: Thu Jun 26, 2003 8:20 pm

Help me: PHP Parse error

Post 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
User avatar
trollll
Forum Contributor
Posts: 181
Joined: Tue Jun 10, 2003 11:56 pm
Location: Round Rock, TX
Contact:

Post 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."
User avatar
Wayne
Forum Contributor
Posts: 339
Joined: Wed Jun 05, 2002 10:59 am

Post 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'] . "'";
Post Reply