Re: Need a 'mysql_insert_id()' code sample
I realize you are looking for C code, but here is a Perl example:
$fnames = "(ca_key, ca_net_id, ca_start_dt, ca_status)";
$values = "(\"$sess_key\", \"$id\", \"$cst_time\", \"Pending\")";
$query = "insert into curr_auth $fnames VALUES $values;";
@qres = do_query($query);
if ($numRows == 0) { die "Fatal: Could not insert into CA"; }
$query = "select LAST_INSERT_ID();";
@qres = do_query($query);
if ($numRows == 0) { die "Fatal: No New CA Number."; }
$new_ca_nbr = $qres[0]+0;
$query = "update user_session set us_ca_nbr=\"$new_ca_nbr\" where us_key=\"$sess_key\";";
@qres = do_query($query);
if ($numRows == 0) { die "Fatal: Could not update User Session with new CA nbr=$new_ca_nbr"; }
Subject
Written By
Posted
Re: Need a 'mysql_insert_id()' code sample
August 17, 2004 11:39AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.