我的WordPress网站上有一个“mlw\\U结果”表,其中存储了测验结果。我使用“测验和调查大师”插件创建这些测验。现在,我需要显示特定测验会话的所有结果(结果Id=7)。
虽然我根据需要获取了所有其他字段,但在需要实际值而不是数组的位置会显示两个数组。
<?php
define( \'SHORTINIT\', true );
require( \'wp-load.php\' );
$id=7;
global $wpdb;
$result_data = $wpdb->get_row("SELECT * FROM {$wpdb->prefix}mlw_results WHERE result_id = {$id}", ARRAY_A);
$quiz_result = unserialize($result_data[\'quiz_results\']);
$response_data = array(
\'quiz_id\' => $result_data[\'quiz_id\'],
\'quiz_name\' => $result_data[\'quiz_name\'],
\'quiz_system\' => $result_data[\'quiz_system\'],
\'quiz_payment_id\' => \'\',
\'user_ip\' => $result_data[\'user_ip\'],
\'user_name\' => $result_data[\'name\'],
\'user_business\' => $result_data[\'business\'],
\'user_email\' => $result_data[\'email\'],
\'user_phone\' => $result_data[\'phone\'],
\'user_id\' => $result_data[\'user\'],
\'timer\' => 0,
\'time_taken\' => $result_data[\'time_taken\'],
\'contact\' => $quiz_result[\'contact\'],
\'total_points\' => $result_data[\'point_score\'],
\'total_score\' => $result_data[\'correct_score\'],
\'total_correct\' => $result_data[\'correct\'],
\'total_questions\' => $result_data[\'total\'],
\'question_answers_array\' => $quiz_result[1],
\'comments\' => \'\'
);
foreach($response_data as $value=> $quiz_result[1]){
echo $quiz_result[1]."<br>";}
?>
我得到的结果是:
1
New Quiz
0
137.97.167.96
John
Webmaster
me@mypersonalmail.com
998121
1
0
02:09:32 PM 04/08/2020
Array
1
50
1
2
Array
我想用实际值替换这些数组。有可能吗?“测验结果”列中存储的数据如下:
a: 5:{i:0;i:89;i:1;a:2:{i:0;a:9:{i:0;s:17:“喀拉拉邦首都”;i:1;s:9:“特里凡顿”;i:2;s:9:“特里凡顿”;i:3;s:0:;s:7:“正确”;s:2:“id”;s:1:“1”;s:6:“分数”;d:1;s:8:“类别”;s:0:;s:13:“问题类型”;s:1:“0”}i: 1;a: 9:{i:0;s:20:“卡纳塔克邦首都”;i:1;s:13:“无一”;i:2;s:0:;i:3;s:0:;s:7:“正确”;s:9:“不正确”;s:2:“id”;s:1:“2”;s:6:“分数”;d:0;s:8:“类别”;s:0:;s:13:“问题类型”;s:1:“0”}i: 2、2;s: 0:“”;s: 7:“联系人”;a: 4:{i:0;a:3:{s:5:“标签”;s:9:“你的名字”;s:5:“价值”;s:4:“约翰”;s:3:“使用”;s:4:“名字”}i: 1;a: 3:{s:5:“标签”;s:10:“您的电子邮件”;s:5:“价值”;s:21::me@mypersonalmail.com“s:3:“使用”;s:5:“电子邮件”}i:2;a:3:{s:5:“标签”;s:13:“您的企业”;s:5:“价值”;s:9:“网站管理员”;s:3:“使用”;s:4:“公司”}i: 3、3;a: 3:{s:5:“标签”;s:10:“您的手机”;s:5:“值”;s:6:“998121”;s:3:“使用”;s:5:“手机”}}s: 8:“timer\\u ms”;i: 89634;}