在我的页面上列出的每条记录中,始终有资源ID#5,就像数字一样。
这是我的sql:
$sorusayisi = 57;
for ($i = 1; $i < $sorusayisi; $i++) {
// $soruId = array();
$soruQues = array();
$soruCevapId = array();
if (strlen($levonter) == 0) {
$sqlSorular = mysql_query("SELECT * FROM tblquestions AS r1 JOIN (SELECT (RAND() * (SELECT MAX(id) FROM tblquestions)) AS id) AS r2 WHERE r1.Id >= r2.Id AND r1.GroupId");
}
else {
$sqllevonter = substr($levonter, 0, -1);
echo $sqlSorular = mysql_query("SELECT * FROM tblquestions AS r1 JOIN (SELECT (RAND() * (SELECT MAX(id) FROM tblquestions)) AS id) AS r2 WHERE r1.Id >= r2.Id AND r1.GroupId NOT IN ($sqllevonter)");
}
$bisey = mysql_fetch_array($sqlSorular);
while ($rsSorular = mysql_fetch_array($sqlSorular)) {
$soruCevapId[] = $rsSorular["Id"];
$soruQues[] = $rsSorular["Question"];
$soruGrId = intval($rsSorular["GroupId"]);
}
$soruGrId = intval($bisey["GroupId"]);
$levonter .= $soruGrId . ',';
$sHint = mysql_query("SELECT * FROM tblhints WHERE GroupId=" . $soruGrId . "");
$rsHint = mysql_fetch_array($sHint);
$soruHint = $rsHint["hint"];
$soruPic = $rsHint["pic"];
$sCevap = mysql_query("SELECT * FROM tblanswers WHERE GroupId=" . $soruGrId . "");
$rsCevap = mysql_fetch_array($sCevap);
$cevapId = $rsCevap["Answer"];
// $soruPic = $rsCevap["pic"];
我看不到任何感觉?
有什么建议吗?
答案 0 :(得分:0)
$sqlSorular
是从mysql_query
返回的资源,您echo
正在使用它:
echo $sqlSorular=mysql_query("SELECT * FROM tblquestions AS r1 JOIN (SELECT (RAND() * (SELECT MAX(id) FROM tblquestions)) AS id) AS r2 WHERE r1.Id >= r2.Id AND r1.GroupId NOT IN ($sqllevonter)");