Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

query string

Status
Not open for further replies.

wolfmah

Programmer
Oct 24, 2001
17
CA
I'm using PHP 4.2.1 and MySQL 3.23.39 for WinXP.

My problem is that I can't seem to be able to pass a value through the URL. I tried to catch the variable with this : $id= HTTP_GET_VARS['id']; I also tried without but it always give me a notice.

The SQL query I'm using :
$query= "SELECT * FROM employees WHERE id = '$id'";

When using the line $id= HTTP_GET_VARS['id'];
Parse error: parse error, unexpected '[' in C:\Web_Wolf_PHP\employee.php on line 4 // Line 4 == $id= HTTP_GET_VARS['id'];

Without using the line $id= HTTP_GET_VARS['id'];
Notice: Undefined variable: id in C:\Web_Wolf_PHP\employee.php on line 17 // Line 17 == SQL query
 
what is the method you use for the form? It must also be GET or you will have a problem..

hth
Bastien

There are many ways to skin this cat,
but it still tastes like chicken
 
You should be using
Code:
$HTTP_GET_VARS['id']
. The variabe requires the
Code:
'$'
sign.
 
Or if version 4.2+ $_GET[id] ***************************************
Party on, dudes!
[cannon]
 
Hey Dude !

You are asking about passing SQL-queries to PHP-scripts !?!?!
That must go wrong !

You are supposed to pass a CGI query like: script?name=michael&alter=25

your whole SQL statement must be ONE parameter in the URL.


cheers, Michael
 
or even more obvious ..
$id= HTTP_GET_VARS['id'];

should read
$id="HTTP_GET_VARS['id']";
______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top