1

我最近将 php 版本从 4 切换到 5.3。我现在如何一些不再工作的代码。我有一个 PHP 脚本,当用户单击链接时,它会从表单中获取数据到新表单中。

首先它识别用户/帐户,然后找到表单数据。

这是帐户数据的代码:

$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']);

…………

这行得通,我可以通过例如以下方式显示数据:

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

然后我有这个代码来获取和显示表单数据:

$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']; ?>

这在 PHP 5.3 版中不再起作用。

任何人都可以告诉我需要将这段代码重新编写成什么,以便它工作......????

提前致谢!

除了评论之外,我还有 ft_get_account_info 的代码:

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

这对于 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;
}

没有关于错误报告的内容。

4

1 回答 1

1

我不知道您的具体问题是什么,但我认为如果您使用所有可用的工具进行调试,您将能够轻松找到您的问题。

对于开发,您应该始终将错误报告级别提高到E_ALL ^ E_STRICT. 您可以在 php.ini 文件中找到此设置。根据手册E_STRICT,这将有助于识别互操作性和兼容性问题,E_ALL直到 PHP 5.4才包含在内。

您可能还想使用 Netbeans 和 XDebug,它们应该允许您逐行执行代码,这将极大地简化调试。此处有设置这些工具的指南:在 NetBeans IDE 中调试 PHP 源代码

于 2013-09-25T07:44:53.640 回答