首页 > 其他 > 详细

PDO beginTransaction (),exec(),commit ()

时间:2014-07-25 16:42:11      阅读:367      评论:0      收藏:0      [点我收藏+]

 

 

    $dsn = ‘sqlsrv:server=.\SQLExpress;Database=thinkphp‘;
    $user = ‘admin‘;
    $password = ‘pass1234‘;

    try {
        $conn = new PDO($dsn, $user, $password);
    } catch (PDOException $e) {
        echo ‘Connection failed: ‘ . $e->getMessage();
    }

    $conn -> beginTransaction ();
    $conn ->exec("create table think_form(
        id int identity(1,1) Not Null,
        title varchar(255) Not Null,
        content varchar(255) Not Null,
        create_time datetime Not Null,
        Primary Key(id))
        "); 
    $conn -> commit (); 
    $conn = null; 

PDO beginTransaction (),exec(),commit (),布布扣,bubuko.com

PDO beginTransaction (),exec(),commit ()

原文:http://www.cnblogs.com/dangkei/p/3867934.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!