$sql = "SELECT * FROM table WHERE id_cat = '$id_cat'";
$result = @($sql,$connection) or die("1. Couldn't execute query.");
$id_bus = array();
while($arrData = mysql_fetch_array($result))
{
$id_bus[] = $arrData["id"];
}
this will do what you want.
The counter isn't necessary, since you can use the [] notation to append to the array.
I'm assuming you're connected to the DB as well.
p.