• 160331


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    </head>
    
    <body>
    <?php
    /*//定义数据源
    $dsn = "mysql:dbname=tt;host=localhost";
    //造PDO对象
    $pdo = new PDO($dsn,"root","123");
    
    //sql语句
    $sql = "select * from info";
    
    //准备执行sql语句
    $ss = $pdo->prepare($sql);
    
    //执行语句
    if($ss->execute())
    {
        //print_r($ss->fetch());    
        
        var_dump($ss->fetchColumn(1));
    }
    else
    {
        echo "失败";
    }*/
    
    $pdo = new PDO("mysql:dbname=tt;host=localhost","root","123");
    
    $sql = "insert into info value(?,?,?,?,?)";
    
    $sa = $pdo->prepare($sql);
    
    /*//给sql语句分配变量
    $sa->bindParam(1,$code);
    $sa->bindParam(2,$name);
    $sa->bindParam(3,$sex);
    $sa->bindParam(4,$nation);
    $sa->bindParam(5,$birthday);
    
    //给变量赋值
    $code = "p110";
    $name = "啊";
    $sex =true;
    $nation = "n002";
    $birthday ="1222-11-11";
    
    //执行语句
    $sa->execute();*/
    
    //执行sql语句简便方法
    $sa->execute(array("p111","按时","true","n002","1111-11-11"));
    
    
    
    
    
    
    ?>
    </body>
    </html>
  • 相关阅读:
    僵尸进程
    理论整理
    SQLServer相关概念
    存储过程
    我的简书地址
    swift pragma mark
    苹果iOS开发中如何直接跳转到App Store页面
    使用cocoadPod updating local specs repositories 卡主
    iOS 代码格式化插件Clang-Format
    iOS错误:AFNetworking Error Domain=NSURLErrorDomain Code=-999
  • 原文地址:https://www.cnblogs.com/zhuxiaolin/p/5343015.html
Copyright © 2020-2023  润新知