betterCode() PHP 2025

Voting

: min(five, three)?
(Example: nine)

The Note You're Voting On

dtutar at yore dot com dot tr
22 years ago
This is very useful function :)

function sql_last_inserted_id($connection, $result, $table_name, $column_name) {
$oid = pg_last_oid ( $result);
$query_for_id = "SELECT $column_name FROM $table_name WHERE oid=$oid";
$result_for_id = pg_query($connection,$query_for_id);
if(pg_num_rows($result_for_id))
$id=pg_fetch_array($result_for_id,0,PGSQL_ASSOC);
return $id[$column_name];
}

Call after insert, simply ;)

<< Back to user notes page

To Top