Jump to content

Recommended Posts

Hi all,

 

  Here a learner, with the following question:

 

  I need to do:

 

 

   $intersection = array_intersect($array1, $array2);

 

  I obtain $array1:

 

 

 

 

          for( $i = 0; $i < count ($myarray1['data']); $i ++)
          {
               $array1 = $myarray1['data'][$i]['place']['id']; 
               
          } 

       

    And I obtain $array2 from database:

 

 

 

    while($row = mysql_fetch_array( $result )) {

$array2 = $row['name'];

} 

 

 

  But when doing:

 

 

    $intersection = array_intersect($array1, $array2);

 

 

 

    outside of the loops, the variables contain the last record obtained in the loop ..

 

    What do I have to do for $array1 and $array2 to contain all the data looped?

 

    Thanks a ton

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.