How to use mysqli_begin_transaction , mysqli_commit, mysqli_rollback in function insert phpgrid

QuestionsHow to use mysqli_begin_transaction , mysqli_commit, mysqli_rollback in function insert phpgrid
daniel g asked 8 years ago

Sorry Sir , Why When I use mysqli_begin_transaction,mysqli_commit,mysqli_rollback isn't working in function insert phpgrid

This exp Syntax not working:
$conn = mysqli_connect(PHPGRID_DBHOST, PHPGRID_DBUSER, PHPGRID_DBPASS, PHPGRID_DBNAME);
$error = 0;

mysqli_begin_transaction($conn);

$sql_first =
"
INSERT
(right syntax)

";

$rslt_first = mysqli_query($sql_first);
if(!$rslt_first)
{
$error++;
}

$sql_second =
"
UPDATE
(wrong syntax)

";

$rslt_second = mysqli_query($sql_second);
if(!$rslt_second)
{
$error++;
}

if($error == 0) /*– <<<<— Use This in the end your sql transaction –*/
{
mysqli_commit($conn);
}else
{mysqli_rollback($conn);
}

Please Your Solution Sir

1 Answers
Abu Ghufran answered 8 years ago

I guess it's more linked to php / mysql query and not php grid api.
You can post it on stackoverflow:

Similar discussion here:
http://stackoverflow.com/questions/17649926/how-does-mysqlicommit-mysqlirollback-work

Your Answer

14 + 19 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?