Hi everyone
my problem how to get the last insert id, i am usind $DAL to connect to the database.
what i have seen so far is that users uses $conn which i am not.
here is the error
mysql_insert_id() expects parameter 1 to be resource, object given
here is my code
global $dal;
$lastInsert = mysql_insert_id($conn);
$custName = $values['Customer'];
$$debitAccount;
$creditAccount;
$tblCustomer = $dal->Table("customer");
$rs = $tblCustomer->Query("Fullname='$custName'");
$data = db_fetch_array($rs);
$custID = $data["CustomerID"];
$Paymentmethod = $values['PaymentMode'];
$amt = $values['PaidAmount'];
$t_amt = $values['TotalAmount'];
$transRef = $values['DucketNumber'];
$balance = $values['BalanceDue'];
$postby = $values['CreatedBy'];
if($Paymentmethod == "CREDIT"){
$creditAccount = 0.0;
$debitAccount = $t_amt;
}else{
$creditAccount =$amt;
$debitAccount =0.0;
}
//** Insert a record into another table ****
$sql = "INSERT INTO acctcustomertransaction (customerId,CustomerName,TransactionDate,DebitTransactionAmount,CreditTransactionAmount,MeansOfCreditPayment,TransactionRef,PostedBy) values ('$custID','$custName',now(),'$debitAccount','$creditAccount','$Paymentmethod','$transRef','$postby')";
CustomQuery($sql);
$Salessql = "INSERT INTO acctsales(SalesOrderId,CustomerId,CustomerName,SalesAmount,ProductAmount,BalanceAmount,CreatedBy) vaues('$lastInsert','$custID','$custName',$amy','$t_amt','$balance','$postby')";
this code is in after record added, please can i get help?