当前位置: 首页>>代码示例>>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;未经允许,请勿转载。