我无法让这个工作 这是我的主页:
<?php
$satt = getfn();
while ($row = mysql_fetch_array($satt)){
echo "<li><a href=\"\">{$row['satake']}</a></li>";}
$yosef = yosef($row["jid"]);
while ($row = mysql_fetch_array($yosef)){
echo "<li>{$row['yosef']}</li>";}
$jidd = jid();
while ($row = mysql_fetch_array($jidd)){
echo "<li>{$row['jid']}</li>";
}
?>
这是我的职能:
<?php
/* function confirm_query($rs){
if (!$rs){
die("eror".mysql.error());
}
}*/
function getfn(){
$query = "SELECT * FROM fn";
$result = mysql_query($query);
//confirm_query($result);
return $result;
}
function yosef($row){
$query = "SELECT `yosef` FROM `satake` WHERE jid = {$row}";
$result = mysql_query($query);
// confirm_query($result);
return $result;
}
function jid(){
$query = "SELECT * FROM `satake` ORDER BY `satake`.`jid` ASC";
$result = mysql_query($query);
return $result;
// confirm_query($result);
}
?>
但这给了我这个错误:
警告:mysql_fetch_array()要求参数1为资源,第28行给出布尔值 第28行在这里:
$yosef = yosef($row["jid"]);
while ($row = mysql_fetch_array($yosef)){
echo "<li>{$row['yosef']}</li>";}
问题在哪里???
答案 0 :(得分:0)
你在while循环之外使用$ row:
while ($row = mysql_fetch_array($satt)){
echo "<li><a href=\"\">{$row['satake']}</a></li>";} // <-- closing bracket while
试试这个:
while ($row = mysql_fetch_array($satt)){
echo "<li><a href=\"\">{$row['satake']}</a></li>";
$yosef = yosef($row["jid"]);
while ($row = mysql_fetch_array($yosef)){
echo "<li>{$row['yosef']}</li>";
}
}