Jump to content

A Question


selenin

Recommended Posts

Hello, it's still a big gap between what I want and what I'm able to, now I built an array and I try that in the foreach the lines with these values don't show up, that's my code:

 

$arr
$i = 0;

foreach ($results as $res) {

echo '<li>';
echo '<a href="'. imdblink($res->imdbid(), $res->year(), $res->title()).'" title="'.$res->title().' '.$res->year().'">'.fewchars("".$res->title()." (".$res->year().")", 35).'</a>';
    //echo "<li> <a href='suggest.php?mid=".$res->imdbid()."'>".$res->title()." (".$res->year().")</li>";
echo '</li>';

    $i++;
    if ($i > 11) break;
}

 

in this example  $arr has these two values:

 

array(2) { [0]=>  int(2010) [1]=>  int(0) }

 

now I try in my foreach where $res->year() has a value from $arr don't show up, but is a bit too difficult for me

Link to comment
https://forums.phpfreaks.com/topic/204521-a-question/
Share on other sites

Yes I know, I try when $res->year() has a value of $arr then not show, I tried it like that:

 

foreach ($results as $res) {
if($res->year() != $arr) {


echo '<li>';
echo '<a href="'. imdblink($res->imdbid(), $res->year(), $res->title()).'" title="'.$res->title().' '.$res->year().'">'.fewchars("".$res->title()." (".$res->year().")", 35).'</a>';
    //echo "<li> <a href='suggest.php?mid=".$res->imdbid()."'>".$res->title()." (".$res->year().")</li>";
echo '</li>';

    $i++;
    if ($i > 11) break;
//}
}
}

 

But it doesn't work because $arr is an array and $res->year() has never all values of $arr

Link to comment
https://forums.phpfreaks.com/topic/204521-a-question/#findComment-1071189
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.