當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PDO::begintransaction方法代碼示例

本文整理匯總了PHP中PDO::begintransaction方法的典型用法代碼示例。如果您正苦於以下問題:PHP PDO::begintransaction方法的具體用法?PHP PDO::begintransaction怎麽用?PHP PDO::begintransaction使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PDO的用法示例。


在下文中一共展示了PDO::begintransaction方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: begin

 /**
 		Begin SQL transaction
 		@return NULL
 	**/
 function begin()
 {
     parent::begintransaction();
     $this->trans = TRUE;
 }
開發者ID:TomGB,項目名稱:f3-crud,代碼行數:9,代碼來源:sql.php

示例2: begin

 /**
  *	Begin SQL transaction
  *	@return bool
  **/
 function begin()
 {
     $out = parent::begintransaction();
     $this->trans = TRUE;
     return $out;
 }
開發者ID:buggithubs,項目名稱:selfoss,代碼行數:10,代碼來源:sql.php

示例3: PDO

<html>
    <body>
<?php 
$userid = $_REQUEST['userid'];
$email = $_REQUEST['email'];
$nome = $_POST['nome'];
try {
    $host = "db.ist.utl.pt";
    $user = "ist177034";
    $password = "sjxdqmu";
    $dbname = $user;
    $db = new PDO("mysql:host={$host};dbname={$dbname}", $user, $password);
    $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $db->begintransaction();
    echo $userid;
    echo $email;
    echo $nome;
    $date = date('Y-m-d H:i:s');
    $sql = "INSERT INTO sequencia(userid,moment) VALUES ({$userid},'{$date}') ;";
    $db->query($sql);
    $sql2 = "select contador_sequencia from sequencia where contador_sequencia >= ALL(select contador_sequencia from sequencia);";
    $contador_seq = $db->query($sql2);
    foreach ($contador_seq as $row) {
        $seqid = $row['contador_sequencia'];
        $sql2 = "SELECT pagecounter + 1 as pg FROM(SELECT userid, pagecounter, nome, idseq, ativa FROM pagina WHERE pagecounter >= ALL(SELECT pagecounter FROM pagina)) a;";
        $page_counter = $db->query($sql2);
        foreach ($page_counter as $row) {
            $pg_count = $row['pg'];
            $sql3 = "INSERT INTO pagina(userid,pagecounter,nome,idseq,ativa) VALUES ({$userid}, {$pg_count} , '{$nome}', {$seqid},1);";
            echo $sql3;
            $db->query($sql3);
開發者ID:jandredias,項目名稱:BD1516,代碼行數:31,代碼來源:updatePagina.php


注:本文中的PDO::begintransaction方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。