Hi,
I'm having a problem either understanding or using in_array.
Here's a representation of the code I'm using:
$query = 'SELECT * FROM sample_table where ID = ' . $['id'];
$data = mysql_query($query);
$object_array = array();
while ($row = mysql_fetch_array($data))
{
array_push($object_array, $row);
}
foreach($object_array as $object)
{
print '<p>' . $object['ID'] . ', ' . $object['Type'];
if([B]in_array[/B]($object['Type'], $object_array))
{
print ' - match!';
}
print '</p>';
}
The above prints out:
466, 1
466, 2
466, 3
466, 4
466, 5
466, 6
466, 7
All I'm trying to do is get it to also print ' - match!' at the end of every row, because that way I should be able to do the same kind of evaluation with another array.
The problem is, this seemingly simple function won't print ' - match!', and I honestly can't figure out why. Is it because the array is multi-dimensional? Everything in the table is an integer, so I know it's not data type problems.
Thank you.