当我添加新记录时,我希望能够返回其id
值(主索引,auto int)。有没有办法做到这一点?
我的代码:
<?
mysql_connect(localhost,"learning_bitcoin","oreo8157");
mysql_select_db("learning_bitcoins") or die( "Unable to select database");
print("open a database");
$query = "INSERT INTO buy VALUES ('','','".$_GET['market'] ."','".$_GET['price'] ."','','".$_GET['shares'] .
"','".$_GET['real'] ."','')";
$rs=mysql_query($query);
if (!$rs) {
echo "Could not execute query: $query\n";
trigger_error(mysql_error(), E_USER_ERROR);
} else {
echo "Query: $query executed\n";
}
?>