码迷,mamicode.com
首页 > 其他好文 > 详细

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

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

标签:style   blog   color   io   for   re   c   cti   

 

 

    $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 ()

标签:style   blog   color   io   for   re   c   cti   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!