私は2つの配列を持っています.1つはSELECTからすべての質問IDを挿入し、もう1つは同じIDを挿入したいが、今回は繰り返しません。2 番目の配列のコードが機能せず、その理由がわかりません。機能しないため(行が異なるため)、SELECTでDISTINCTを使用できません。これには2つの選択を使用したくありません。
$query_slidersanswers= "SELECT A.QuestionIDFK, A.AnswerIDPK, A.AnswerValue, A.SortOrder
FROM tblquestionset AS QS
INNER JOIN tblquestion AS Q ON QS.QuestionIDFKPK = Q.QuestionIDPK
INNER JOIN tblanswer AS A ON Q.QuestionIDPK = A.QuestionIDFK
WHERE QS.QuestionSetIDPK = '0'
AND QS.OnPage = '1'
AND Q.Constructor = '".$_session['slider']."'";
$Query_Sliders= mysql_query($query_slidersanswers);
$currentQuestionID= 0;
while($row_Slider=mysql_fetch_array($Query_Sliders)){
$QuestionID=$row_Slider['QuestionIDFK'] ;
$AnswerID=$row_Slider['AnswerIDPK'] ;
$AnswerValue=$row_Slider['AnswerValue'] ;
$SortOrder=$row_Slider['SortOrder'] ;
$tableslidersqid[] = array($QuestionID);
if($QuestionID != $currentQuestionID){
//I DO THIS FOR OBTAIN other array with THE UNIQUES ID'S (non repeated)
$tableslidersREALqid[] = array($QuestionID);
$CurrentQuestionID = $QuestionID;
}
}