我想按问题编号更改数组的工作
例如:$array[$qssr['id']]
因为我把它们放在循环中
例如:foreach ($array[$qssr['id']] as &$value)
数组的值
$answers1 = mysql_query("select * from answers where qid='".$qnid."' LIMIT 0, 1") or die("error");
$answersr1 = mysql_fetch_assoc($answers1);
我的实验失败了:
function get_answer($qid)
{
$answers = mysql_query("select * from answers where qid='".$qid."' LIMIT 0, 1") or die("error");
$answersr = mysql_fetch_assoc($answers);
$arr= array();
foreach($answersr as $v)
{
$arr[] = $v['answer'];
}
}
$array = array();
$qss = mysql_query("select * from qs where sid='$finalsid' order by id asc") or die("error");
$qssr = mysql_fetch_assoc($qss);
$qanswer = get_answer($qssr['id']);
$array[$qssr['id']] = $q_answer;
foreach ($array[$qssr['id']] as &$value)