sql - PHP Loops and Arrays

940

How can I list all array items except that there is another Array ? Example:

First array:

$idea_id[$row["id"]] = $row["id"];

Second array:

$m_voted[$votedke] = $row["ideaid"];

Keeping this datas in separate SQL tables. And how to list all$idea_id but if

$idea_id[this_item] == $m_voted[any_item]

thenthis item not listing.

819

Answer

Solution:

From your question what i understand is you want to check the data exists in the second array.

You can usein_array function which check if the idea_id is in m_voted array

foreach($idea_id as $id){
   if(in_array($id,$m_voted)){
       echo "{$id}<br/>";
   }
}

People are also looking for solutions to the problem: php - Why do i have to click twice?

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.