zoukankan      html  css  js  c++  java
  • mysql函数操作

    <?php
        try{
            $dbh = new PDO('mysql:dbname=testdb;host=localhost', 'mysql_user', 'mysql_pwd');
        }catch(PDOException $e){
            echo '数据库连接失败:'.$e->getMessage();
            exit;    
        }
        
        $query = "UPDATE contactInfo SET phone='15801680168' where name='高某某'"; 
        //使用exec()方法可以执行INSERT、UPDATE和DELETE等
        $affected = $dbh->exec($query);       
        
        if($affected){          
            echo '数据表contactInfo中受影响的行数为:'.$affected; 
        }else{
            print_r($dbh->errorInfo());     
        }
  • 相关阅读:
    Codeforces
    Codeforces
    Codeforces
    Codeforces
    Codeforces
    Codeforces
    Codeforces
    Codeforces
    洛谷
    GXU
  • 原文地址:https://www.cnblogs.com/qingxiaoping/p/5014961.html
Copyright © 2011-2022 走看看