Re: [PHP] Different Problem [Re: Passing a Variable to PHP Via the URL]

2002-06-11 Thread jsegovia

Jason Soza <[EMAIL PROTECTED]> wrote:

> Rather than just setting globals on in php.ini, try this:

Thanks a lot.  Your and Philip Olson's responses have got me thinking in the direction 
of better security and code.

I am going to turn register_globals off and rewrite the code.

Now if only I can get my POST requests working with Personal Web Server.  8-(

Jesse

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




[PHP] Different Problem [Re: Passing a Variable to PHP Via the URL]

2002-06-11 Thread jsegovia

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", $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