我需要能够在mysql中调用函数。一个例子是:
$dbh = DBI->connect(......)
$sqlQuery = "INSERT INTO xxx VALUES ......";
$sth = $dbh->prepare($sqlQuery);
$sth->execute();
#The missing code is here
#Call the function mysql_insert_id to retrieve the id of the last inserted record
#Do something with the id
我该怎么做?
答案 0 :(得分:2)
来自perldoc DBI
:
$rv = $dbh->last_insert_id($catalog, $schema, $table, $field);
答案 1 :(得分:2)