This question already has an answer here:
i cant get this to work this is my homepage :
<?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>";
}
?>
and this is the my functions :
<?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);
}
?>
but this give me this error :
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in on line 28 where line 28 is here :
$yosef = yosef($row["jid"]);
while ($row = mysql_fetch_array($yosef)){
echo "<li>{$row['yosef']}</li>";}
where is the problem ???
</div>
You use $row outside the while loop:
while ($row = mysql_fetch_array($satt)){
echo "<li><a href=\"\">{$row['satake']}</a></li>";} // <-- closing bracket while
Try this:
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>";
}
}