I have a query that collects multple ID numbers and stores them into a php Array. I then want to make a mysql query for every result in the php Array. I believe I am on the right track but am getting an error saying the join()
method has invalid arguments. $IdArray is a valid array and does have Ids stored in it, I am 100% sure. Here is my code,
$secondArray = array();
$ids = join(',', $IdArray);
$query = "SELECT * FROM test WHERE user = '$user' AND id IN ($ids)";
$results = mysql_query($query);
while($row = mysql_fetch_array($results)){
$secondArray[] = "YES";
}
another problem is I want a piece of information to be stored into $secondArray
even if a result hasnt been found. To make it clear lets say the $ids
are like this ['0','1','2','3']
and the table test
only has the id 2
stored in it. But I want the $secondArray
to look like this ['NO','NO','YES','NO']