I found out that in fact PHP is creating a variable with the name and value I'm 
passing through a URL from the querystring.  But it's still not working as planned.

The url server/test.php?id=1 creates the following results in my code:

printf("Variables:  %s\n<br>", $HTTP_GET_VARS["id"]);

This line works - there IS a variable named 'id' in my page and it has the correct 
value, 1.

if ($id) {}

This fails.  If I test 'id' instead of '$id' then it works but my page doesn't seem to 
equate 'id=1' with the presence of $id.

$result = mysql_query("SELECT * FROM employees WHERE id=$id",$db);

This doesn't work - again it seems $id isn't being treated properly.  I get this error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource

If I hardwire my page with the line '$id=1;' before the if statement and the query 
everything works.

So why isn't the variable from my URL being treated properly?

Jesse

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to