I have a strange problem.
When I execute the following statements with a PHP file, it is generating 3 rows instead of 1 row. What could be causing this???? The program is NOT looping. I am using smarty and php with mysql database.
$sql ="INSERT INTO tbl_order ('user_id', 'product_id', 'package_id', 'order_payment_amt',
'order_product_items', 'order_revisions', 'order_transactionid', 'order_status',
'order_turnaroundtime', 'order_date')
VALUES ('$user_id', '$product_id', '$package_id',
'$order_payment_amt', '$order_product_items', '$order_revisions', '$order_transactionid',
'$order_status', '$order_turnaroundtime', '$created_date')";
$order_id = $Db->execInsertQuery($sql); return $order_id;
The query itself will only insert a single row. You are probably executing it multiple times, which is not understandable without the surrounding code.
Quite obviously, something is causing that query to execute three times. But without inspecting the program flow it's impossible to tell what, how, or why.
If you have no logging facility and no debugger easily available, you can maybe try and add a UNIQUE INDEX
on, say, user_id, product_id, package_id
so that the extra INSERT
s fail, causing the program to dump some possibly useful information about where it crashed.