$question = mysql_query("SELECT * FROM `debonere_questions`", $this->db);
while($user_data[]=mysql_fetch_assoc($question)){
$sub_question = mysql_query("SELECT * FROM `debonere_sub_question` WHERE`q_id`='".$user_data['q_id']."'", $this->db);
while($user_data1=mysql_fetch_assoc($sub_question_result)){
echo $user_data1['sub_question'];
}
}
我希望将它存储在一个数组中。
答案 0 :(得分:0)
做那样的事
$question = mysql_query("SELECT * FROM `debonere_questions`", $this->db);
while($user_data[]=mysql_fetch_assoc($question)){
$sub_question = mysql_query(
"SELECT * FROM `debonere_sub_question` WHERE `q_id`='".$user_data['q_id']."'",
$this->db);
while($user_data1=mysql_fetch_assoc($sub_question_result)){
$array[] = $user_data1['sub_question'];
}
}
你应该使用MySQLi或PDO。