Carsten ANdreasen
Carsten ANdreasen

Reputation: 11

Switched from PHP version 4 to version 5.3 - code not working anymore

I recently swithced php version from 4 to 5.3. I now how some code that is not working anymore. I have a PHP script that fetches data from a form into a new form, when a user clicks a link.

First it recognizes the user/account and after that it finds the form data.

This is the code for the account data:

$account_info = ft_get_account_info($_SESSION["ft"]["account"]["account_id"]);
$emailadresse = ($account_info['email']);
$accountid = ($account_info['account_id']);
$firstname =($account_info['first_name']);
$lastname =($account_info['last_name']);

.... ....

This works, and i can display the data through for example a:

<?php echo $_POST['firstname']; ?>

I then have this code in order to fetch and display the form data:

$submission_info = ft_get_submission_info($form_id, $submission_id);
$submission_id = ($submission_info['submission_id']);
$partname = ($submission_info['partname']);
$ponumber = ($submission_info['ponumber']);
....
....
<?php echo $_POST['partname']; ?>

This is not working anymore in version 5.3 of PHP.

Can anyone please tell what i need to re-write this code into, in order for it to work...????

Thanks in advance!

In addition to the comments i have this code for the ft_get_account_info:

$_SESSION["ft"]["account"]  = ft_get_account_info($account_info["account_id"]);

And this for the ft_get_submission_info:

/**
* Returns all information about a submission. N.B. Would have been nice to have made this just a
 * wrapper for ft_get_submission_info, but that function contains hooks. Need to revise all core
 * code to allow external calls to optionally avoid any hook calls.
 *
 * @param integer $form_id
 * @param integer $submission_id
 */
function ft_api_get_submission($form_id, $submission_id)
{
  global $g_table_prefix, $g_api_debug;
  // confirm the form is valid
  if (!ft_check_form_exists($form_id))
  {
    if ($g_api_debug)
    {
      $page_vars = array("message_type" => "error", "error_code" => 405, "error_type" => "user");
      ft_display_page("../../global/smarty/messages.tpl", $page_vars);
      exit;
    }
    else
      return array(false, 405);
  }
  if (!is_numeric($submission_id))
  {
    if ($g_api_debug)
    {
      $page_vars = array("message_type" => "error", "error_code" => 406, "error_type" => "user");
      ft_display_page("../../global/smarty/messages.tpl", $page_vars);
      exit;
    }
    else
      return array(false, 406);
  }
  // get the form submission info
  $submission_info = mysql_query("
     SELECT *
     FROM   {$g_table_prefix}form_{$form_id}
     WHERE  submission_id = $submission_id
              ");
  $submission = mysql_fetch_assoc($submission_info);
  return $submission;
}

Nothing on the error reporting.

Upvotes: 1

Views: 113

Answers (1)

Gustav Bertram
Gustav Bertram

Reputation: 14901

I don't know what your specific issue is, but I figure that if you use all the tools available to you for debugging, you'll be able to find your issue easily.

For development, you should always up your error reporting level to E_ALL ^ E_STRICT. You can find this setting in your php.ini file. E_STRICT specifically will help identify interoperability and compatibility issues, and is not included in E_ALL until PHP 5.4, according to the manual.

You may also want to use Netbeans and XDebug, which should allow you to step through your code line by line, which will simplify debugging immensely. There is a guide for setting up these tools here: Debugging PHP Source Code in the NetBeans IDE

Upvotes: 1

Related Questions