Re: [PHP-DB] Register Globals = OFF not passing variable
Daniel, Thanks. Thats what I was looking for. Regards, Craig On Sep 24, 2004, at 9:40 PM, Daniel Watrous wrote: Craig, I don't see where you are calling the function "display_private_results", but I think I know what you are after. It appears you are expecting POST data and so have used the _POST superglobal. You have one of two options: Option 1: call the function sending parameters as you have shown below, but use superglobals e.g. display_private_results($_POST["user_id"], $_POST["area"], $_POST["username"]); NOTE: this would make it seem a little awkward to use the _POST super global inside the function you may want to put it outside the function Option 2: call the function sending NO parameters e.g. display_private_results() and re-write your function to look like this: function display_private_results() { if ($_POST['postback_private_results']) { include "include/db.php"; $query = "SELECT routes.*, users.* FROM users, routes WHERE area='$_POST["area"]' AND username='$_POST["username"]' "; and so on... Hope this helps. If it doesn't I suspect that some reading on superglobals will resolve your dilemma... http://www.php.net/manual/en/language.variables.predefined.php Daniel Watrous - Original Message ----- From: "Craig Hoffman" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, September 24, 2004 7:12 PM Subject: [PHP-DB] Register Globals = OFF not passing variable Hey Folks, I can use some help here. I am changing some scripts around so they work with (register) globals off. I am trying to pass variables in a function and it does not seem to be passing. The script work fine with globals turned on. I would really like to have them work with RG turned off. Any help would be appreciated. Here is a short example: Much Thanks, Craig -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Register Globals = OFF not passing variable
Craig, I don't see where you are calling the function "display_private_results", but I think I know what you are after. It appears you are expecting POST data and so have used the _POST superglobal. You have one of two options: Option 1: call the function sending parameters as you have shown below, but use superglobals e.g. display_private_results($_POST["user_id"], $_POST["area"], $_POST["username"]); NOTE: this would make it seem a little awkward to use the _POST super global inside the function you may want to put it outside the function Option 2: call the function sending NO parameters e.g. display_private_results() and re-write your function to look like this: function display_private_results() { if ($_POST['postback_private_results']) { include "include/db.php"; $query = "SELECT routes.*, users.* FROM users, routes WHERE area='$_POST["area"]' AND username='$_POST["username"]' "; and so on... Hope this helps. If it doesn't I suspect that some reading on superglobals will resolve your dilemma... http://www.php.net/manual/en/language.variables.predefined.php Daniel Watrous - Original Message - From: "Craig Hoffman" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, September 24, 2004 7:12 PM Subject: [PHP-DB] Register Globals = OFF not passing variable > Hey Folks, > I can use some help here. I am changing some scripts around so they > work with (register) globals off. I am trying to pass variables in a > function and it does not seem to be passing. The script work fine > with globals turned on. I would really like to have them work with RG > turned off. Any help would be appreciated. Here is a short example: > > function display_private_results($user_id, $area, $username) > { > if ($_POST['postback_private_results']) > { > include "include/db.php"; > $query = "SELECT routes.*, users.* FROM users, routes WHERE > area='$area' AND username='$username' "; > and so on... > > Much Thanks, > Craig > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Register Globals = OFF not passing variable
My apologies for not being clear. ;) I am not getting an error message. The script works just fine when Register Globals are turned on in the php.ini file. I am simply trying to understand what I need to change in order to have RG off and still have my code to work. See the area of the code where the functions start function display_private_results($user_id, $area, $username) This seems to be the problem area. These variables are not being passed when registered globals are turned OFF. On Sep 24, 2004, at 8:51 PM, M Saleh EG wrote: nothing's clear !! What's the error that u get? wat does the function get or return?? is it a variable scope problem? or what... I dont get the picture.. maybe u should paste the error ur getting.. On Fri, 24 Sep 2004 20:12:46 -0500, Craig Hoffman <[EMAIL PROTECTED]> wrote: Hey Folks, I can use some help here. I am changing some scripts around so they work with (register) globals off. I am trying to pass variables in a function and it does not seem to be passing. The script work fine with globals turned on. I would really like to have them work with RG turned off. Any help would be appreciated. Here is a short example: function display_private_results($user_id, $area, $username) { if ($_POST['postback_private_results']) { include "include/db.php"; $query = "SELECT routes.*, users.* FROM users, routes WHERE area='$area' AND username='$username' "; and so on... Much Thanks, Craig -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- M.Saleh.E.G 97150-4779817 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Register Globals = OFF not passing variable
Hey Folks, I can use some help here. I am changing some scripts around so they work with (register) globals off. I am trying to pass variables in a function and it does not seem to be passing. The script work fine with globals turned on. I would really like to have them work with RG turned off. Any help would be appreciated. Here is a short example: function display_private_results($user_id, $area, $username) { if ($_POST['postback_private_results']) { include "include/db.php"; $query = "SELECT routes.*, users.* FROM users, routes WHERE area='$area' AND username='$username' "; and so on... Much Thanks, Craig -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php