Jump to content

Recommended Posts

I just installed php5 (along with Apache 2.0.59 and mySQL 5.0.22) on a new computer.

 

PHP seems to work okay - phpinfo() shows all parameters in browser window - however, when I tested some php files that access a mysql database, it appears that variables are not being passed from one page to another. Both the php files and the mysql database are on a development server on the new computer.

 

For example: one page lists all members in the database. In php4, when you clicked on a link to a specific member, the recordID was passed to the next page, which displayed member details. In php5, the members page shows up fine (ie, the database can be accessed), but when clicking on a link to a specific member, the same default value shows up for every member. The recordID from the previous page is not being passed. The same pages work fine on my production server which is running php4.  ???

 

register_globals = Off in the php.ini file.

 

Turning register_globals on does not seem to make a difference.

I am using $_GET.

 

Here is some sample code for a list of member names linked to their detailed information:

 

<a href="../member_detail.php?recordID=<?php echo $row_rs_Editor['Member_ID']; ?>"><?php echo $row_rs_Editor['Member_First']; ?> <?php if ($row_rs_Editor['Member_Middle'] <> NULL) echo $row_rs_Editor['Member_Middle'].' '; ?><?php echo $row_rs_Editor['Member_Last']; ?><?php if ($row_rs_Editor['Member_Suffix'] <> NULL) echo ', '. $row_rs_Editor['Member_Suffix']; ?></a>

 

When clicking on the link above, I get the correct MemberID in php4. However, in php5 it always returns the default value $varRecordID_rs_Member = "68".

 

Here is some sample code for the detailed information in which the recordID should be passed to this page by clicking on the link from the previous page (above):

 

<?php
$varRecordID_rs_Member = "68";
if (isset($HTTP_GET_VARS['recordID'])) {
  $varRecordID_rs_Member = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['recordID'] : addslashes($HTTP_GET_VARS['recordID']);
}
mysql_select_db($database_conn_sdpen, $conn_sdpen);
$query_rs_Member = sprintf("SELECT * FROM tbl_member,tbl_zip WHERE tbl_member.Member_ID = '%s' AND tbl_member.Zip_Code=tbl_zip.Zip_Code", $varRecordID_rs_Member);
$rs_Member = mysql_query($query_rs_Member, $conn_sdpen) or die(mysql_error());
$row_rs_Member = mysql_fetch_assoc($rs_Member);
$totalRows_rs_Member = mysql_num_rows($rs_Member);

$varRecordID_rs_Member_Subject = "68";
if (isset($HTTP_GET_VARS['recordID'])) {
  $varRecordID_rs_Member_Subject = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['recordID'] : addslashes($HTTP_GET_VARS['recordID']);
}
mysql_select_db($database_conn_sdpen, $conn_sdpen);
$query_rs_Member_Subject = sprintf("SELECT * FROM tbl_member_subject,tbl_member,tbl_subject WHERE tbl_member.Member_ID=tbl_member_subject.Member_ID AND tbl_subject.Subject_ID=tbl_member_subject.Subject_ID AND tbl_member.Member_ID = %s ORDER BY tbl_subject.Subject_Name", $varRecordID_rs_Member_Subject);
$rs_Member_Subject = mysql_query($query_rs_Member_Subject, $conn_sdpen) or die(mysql_error());
$row_rs_Member_Subject = mysql_fetch_assoc($rs_Member_Subject);
$totalRows_rs_Member_Subject = mysql_num_rows($rs_Member_Subject);

$colname_rs_Member_Service = "68";
if (isset($HTTP_GET_VARS['recordID'])) {
  $colname_rs_Member_Service = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['recordID'] : addslashes($HTTP_GET_VARS['recordID']);
}
mysql_select_db($database_conn_sdpen, $conn_sdpen);
$query_rs_Member_Service = sprintf("SELECT * FROM tbl_member_service,tbl_member,tbl_service,tbl_type WHERE tbl_member.Member_ID=tbl_member_service.Member_ID AND tbl_service.Service_ID=tbl_member_service.Service_ID AND tbl_type.Type_ID=tbl_service.Type_ID AND tbl_member.Member_ID = %s ORDER BY tbl_type.Type_ID, tbl_service.Service_Name ", $colname_rs_Member_Service);
$rs_Member_Service = mysql_query($query_rs_Member_Service, $conn_sdpen) or die(mysql_error());
$row_rs_Member_Service = mysql_fetch_assoc($rs_Member_Service);
$totalRows_rs_Member_Service = mysql_num_rows($rs_Member_Service);

$colname_rs_Committee = "68";
if (isset($HTTP_GET_VARS['recordID'])) {
  $colname_rs_Committee = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['recordID'] : addslashes($HTTP_GET_VARS['recordID']);
}
mysql_select_db($database_conn_sdpen, $conn_sdpen);
$query_rs_Committee = sprintf("SELECT * FROM tbl_committee_member,tbl_member,tbl_committee WHERE tbl_member.Member_ID=tbl_committee_member.Member_ID AND tbl_committee.Committee_ID=tbl_committee_member.Committee_ID AND tbl_member.Member_ID = %s ORDER BY tbl_committee.Committee_ID", $colname_rs_Committee);
$rs_Committee = mysql_query($query_rs_Committee, $conn_sdpen) or die(mysql_error());
$row_rs_Committee = mysql_fetch_assoc($rs_Committee);
$totalRows_rs_Committee = mysql_num_rows($rs_Committee);

$varRecordID_rs_Member_Project = "68";
if (isset($HTTP_GET_VARS['recordID'])) {
  $varRecordID_rs_Member_Project = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['recordID'] : addslashes($HTTP_GET_VARS['recordID']);
}
mysql_select_db($database_conn_sdpen, $conn_sdpen);
$query_rs_Member_Project = sprintf("SELECT * FROM tbl_member_project,tbl_member,tbl_project WHERE tbl_member.Member_ID=tbl_member_project.Member_ID AND tbl_project.Project_ID=tbl_member_project.Project_ID AND tbl_member.Member_ID = %s ORDER BY tbl_project.Project_Name", $varRecordID_rs_Member_Project);
$rs_Member_Project = mysql_query($query_rs_Member_Project, $conn_sdpen) or die(mysql_error());
$row_rs_Member_Project = mysql_fetch_assoc($rs_Member_Project);
$totalRows_rs_Member_Project = mysql_num_rows($rs_Member_Project);
?>
<?php  $lastTFM_nest = "";?>

 

Thanks.

I see you are using the old $HTTP_GET_VARS.

 

PHP5 introduced a setting called register_long_arrays and is disabled by default. in the php.ini This was brought in because the old superglobals $HTTP_*_VARS was made depreciated when the newer superglobals was introduced to replace them.

 

What you should do is either enable the register_long_arrays in a .htaccess file/server configuration. Or the other option is to change your code to use $_GET rather than $HTTP_GET_VARS (recommended).

 

If you change your code it should still work with PHP4.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.