$sql = mysql_query("SELECT * FROM tabla");while ( $row = mysql_fetch_array($sql)){ $array[] = $row[id_nombre].$row[nombre];}