我最近将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']);
.... ....
这是有效的,我可以通过例如a:
显示数据<?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;
}
错误报告中没有任何内容。
答案 0 :(得分:1)
我不知道您的具体问题是什么,但我认为如果您使用所有可用的工具进行调试,您将能够轻松找到问题。
对于开发,您应始终将error reporting级别提升至E_ALL ^ E_STRICT
。您可以在php.ini文件中找到此设置。 E_STRICT
专门用于帮助确定互操作性和兼容性问题,并且在PHP {5.4} according to the manual之前不会包含在E_ALL
中。
您可能还想使用Netbeans和XDebug,这应该允许您逐行执行代码,这将极大地简化调试。这里有一个设置这些工具的指南:Debugging PHP Source Code in the NetBeans IDE