CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Strange behavior! (RESOLVED WITH SHAME)

Print topic Send  topic

Author Message
saseow

Posts: 744
Posted: 08/11/2010, 6:41 AM

In the Before Initialize event of a page I am adding a parameter to the URL that tells which season is currently in use. This works perfectly on my local machine but in production, the parameter value always reverts to 1. I am putting the value in a variable called $current_season.

Here is the code:

global $FileName;
if (CCGetFromGet("s_season_id","") == "") {
header("Location: " . $FileName."?". CCAddParam(CCGetQueryString("QueryString", ""), "s_season_id", $current_season) );
CCSetSession("season",$current_season);
}

The resulting URL always ends in default.php?s_season_id=1 no matter what the value of $current_season is.
Could it be a setting in the PHPINI file relating to Global Variables?

Any light shed on this would be great!

Thanks,

Trevor
View profile  Send private message
datadoit
Posted: 08/11/2010, 6:57 AM

Look at how and where you're defining $current_season. Looks like it's
being defined as an integer. So, if there's any text value for the
variable, then it'll always be '1', or true.

When you define $current_season, define it as text (or var).

var $current_season;
$current_season = "Winter";
datadoit
Posted: 08/11/2010, 7:02 AM

You can see how the variable is defined via:

echo gettype($current_season); exit;
saseow

Posts: 744
Posted: 08/11/2010, 7:36 AM

Thanks for the reply datadoit.
I am getting the variable from the database table that holds the seasons and it is the primary key ID which is an integer and it is an autoincrement key.

As I said, it works perfectly on my server but not on the production server so I tend to think that it is a PHP setting or something?????

Really has me stumped!
View profile  Send private message
datadoit
Posted: 08/11/2010, 8:32 AM

In the section where you set $current_season, is it defined as Global there?

global $current_season;

And then in your reference section, do the same at the top of your routine:

global $current_season;

Recommendation: register_globals should be off in both locations (local
development and production servers). Many one-size-fits-all hosting
providers like to leave it on for backwards compatibility. You should
be able to turn it off for your individual account.
saseow

Posts: 744
Posted: 08/11/2010, 8:49 AM

datadoit, I have found the hassle which you will not believe. I am using opera and have the link in the speed dial and had forced the parameter during testing. I am so embarrassed!

Sorry to waste your time. !!!!!!
View profile  Send private message
datadoit
Posted: 08/11/2010, 9:41 AM

Happens to the best of us. :)

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.