Jump to content

undefined Variable Issue due to moving servers


rachae1

Recommended Posts

Hi I am hoping someone can help.

My hosting company has just moved my website to a different server, and I noticed that it was giving me blank pages, I added in some debug and now I am getting undefined variable errors and I don't know why or how to fix it.

The Page which has broken currently gets its information from the database from the url.
RewriteRule ^reviews/([^/]*)\/$ /bingosite.php?h1=$1 [L]

The code in the broken page that is throwing out undefined variable errors is the following:

<? $query = mysql_query("SELECT * FROM link where linktype='bingo' and h1 ='".StripUrl101(ucwords($h1))."'");  { while($row =mysql_fetch_assoc($query)) extract($row);?>

<? if ($linkType=="bingo") { ?>

<?php echo "$h1"; ?>

<? }  } ?>

I have used this code for years so it could be that it is old but as I only know basic PHP I am very stuck and the hosting company isn't being very helpful.

 

Just to add if I write <? $query = mysql_query("SELECT * FROM link where linktype='bingo' and h1 ='Quick Bingo'");  { while($row =mysql_fetch_assoc($query)) extract($row);?>

The results for Quick Bingo appear on the page. However it needs to work dynamically like it was doing before.

If anyone can help it would be appreciated.

Thanks

Rachael
 

 

 

I think  register_globals was set to OFF.

That is what it should of been in the first place (and should of never existed). It has been disabled by default since 4.2.0 which was release over 14 years ago!

 

Instead you need to get the input from the corresponding superglobal variable

way back in php4.1 (December 2001), php introduced the superglobals - $_POST, $_GET, $_COOKIE, ... in php4.2 (April of 2002), they turned register_globals off by default, because programmers were expected to start using the superglobal variables to access external data. register_globals being on started throwing deprecated errors in php5.3 (June 2009), and have been completely removed in php5.4 (March 2012.)

 

turning register globals on is at best a stop-gap measure since they have been removed from php versions starting over two years ago. time to update your code to use $_GET['h1'] to access values supplied in the url query string.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.