Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.