// insert the stuff $DB->query("INSERT INTO $t[fam] (name,city) VALUES ('$fam_name','$newcity')", __FILE__, __LINE__); // is there another way to obtain the ID of the freshly inserted info without pulling it again? $famid = $DB->fetch("SELECT id FROM $t[fam] WHERE name='$fam_name'", __FILE__, __LINE__); // table that is connected to the fam table (id - fam) $DB->query("UPDATE $t[mob] SET fam='$famid[id]', famrank='1' WHERE id='$id'", __FILE__, __LINE__); PHP: Just something that got me wondering.
what templete engine you are use? and this is the simplest way you cant merge select + update+insert i think
Yeah there is, mysql_insert_id http://php.net/manual/en/function.mysql-insert-id.php $famid = mysql_insert_id();
None. Yeah, I know that they can be merged but I'm not interested in super hardcore queries. Way over my head. Brilliant! I knew there had to be something