I am manually adding a record using PHP (sourcerer) into Jdatabase. I wish to select the record that was added using the insert query below. Is there a wayout without using another query with where clause to get the same record added by the insert query? Thanks in advance.

I don't want to get the last row of the table in which the record was inserted.

Insert query:

$query = $db->getQuery(true);
$columns = array('teacher_id', 'sub_code','active');
$values = array($db->quote($teacher), $db->quote($sub_code),1);
    ->values(implode(',', $values));



directly after executing. This should give you the last inserted id.

Not the answer you're looking for? Browse other questions tagged or ask your own question.