mmmmm. . . why would you want an array ($data[0]) if you only want one key? A better way to do this would be to have each id be a different key in the array. Simple enough.
while($row = mysql_fetch_array($query)) {
$data[] = $row["id"];
}
That will create an array, $data, and each key will hold a different id. So if you have three id's
1, 2, and 3
The output will look like this:
$data
0 => 1
1 => 2
2 => 3
However if you want it to output a variable that holds the value "123" for whatever reason, you could do it like this:
$ids = "";
while($row = mysql_fetch_array($query)) {
$ids .= $row["id"]
}
I don't think this is a very good way to do it. What if you you have double-digit id's (ten and above). You'll have a string that looks like this
01234567891011121314151617181920
That's just ugly. Array would be not only nicer, but much easier to use for other purposes by looping through.
Good luck.
Cgraz