$q = mysql_query("SELECT * FROM `table` WHERE `name`='$name'") or die(mysql_error());$a = mysql_fetch_array($q);echo $a['id'];