PHP + MySQL transactions examples

后端 未结 9 2332
一整个雨季
一整个雨季 2020-11-21 11:50

I really haven\'t found normal example of PHP file where MySQL transactions are being used. Can you show me simple example of that?

And one more question. I\'ve alr

9条回答
  •  长情又很酷
    2020-11-21 12:06

    One more procedural style example with mysqli_multi_query, assumes $query is filled with semicolon-separated statements.

    mysqli_begin_transaction ($link);
    
    for (mysqli_multi_query ($link, $query);
        mysqli_more_results ($link);
        mysqli_next_result ($link) );
    
    ! mysqli_errno ($link) ?
        mysqli_commit ($link) : mysqli_rollback ($link);
    

提交回复
热议问题