Devi usare l'output di mysql_query in mysql_fetch_array .
$res = mysql_query($test_query);
if ($res === false) {
throw new Exception("query failed");
}
$row = mysql_fetch_array($res);
echo $row["id"];
Tieni presente che questo legge solo uno riga. Se vuoi di più usa il while la costruzione del loop puoi trovarla qui:https://php.net/mysql_fetch_array
Se hai appena fatto un INSERT uso della query mysql_insert_id()
per recuperare l'id. Questa è una caratteristica di MySQL. Funziona in combinazione con AUTO_INCREMENT opzione.
Inoltre, se stai creando un nuovo sito, usa mysqli_* funzioni invece di mysql_* . Quest'ultimo è deprecato.