Help with array, again
Posted: Thu Feb 10, 2005 10:58 pm
I need to get a list of IDs from one of my database tables, and then check to see if a given ID # is not in the list of IDs.
I have:
So, as I know, this only returns one ID. I need a list. So I figured this would work:
But again, the value of $ids is only one ID
Any help here?
I have:
Code: Select all
<?
$sql = "SELECT id FROM my_table";
$query = mysql_query($sql)
$array = mysql_fetch_array($sql);
if(!in_array($id, $array) { die(); }
?>Code: Select all
<?
$sql = "SELECT id FROM my_table";
$query = mysql_query($sql)
while($array = mysql_fetch_array($query)) {
$ids = $arrayї'id']; }
if(!in_array($id, $ids) { die (); }Any help here?