I have been trying to make such functionality that will make sure that on click all the values are being stored in the multiple tables of the database successfully. I read an article about it and it says :
" In PHP there are no such methods and the we must use the direct SQL. (In PHP PDO there are such methods.) "
Kindly let me know is it possible to embed begin transaction and end transaction in an sql query only because i never worked on PDO and the only idea i have is to make multiple insertion to tables in one SQL query.
Rough idea
<?php
$sql = "
Begin Transaction
insert into .............
insert into ...........
End Transaction "
mysql_query($sql) ?>
SOLUTION THAT I FOUND:
mysql_select_db($database_dany, $dany);
if (mysql_query('BEGIN')) {
if (
mysql_query($query1) &&
mysql_query($query2) &&
mysql_query($query3) &&
mysql_query($insertSQL)
)
$result = mysql_query('COMMIT'); // both queries looked OK, save
else
{
mysql_query('ROLLBACK'); // problems with queries, no changes
echo "There are some problemo!!!";
}