zoukankan      html  css  js  c++  java
  • PHP 学习1.1

    1 链接mysql 数据简单测试

      <html>
    <head>
      <title></title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    </head>
    <body>
    <?php
      $mysqli = new mysqli();
      $mysqli->connect("localhost","root","sulin","test");
      if($mysqli->errno == 0)
            {
               $sql = "SELECT * FROM table_1";
               $result = $mysqli->query($sql);
               echo "<br/>Result row nums:".$result->num_rows."<br/>";
               while(list($id,$name,$birthday,$remark) = $result->fetch_row())
               {
                   echo "$id : $name : $birthday : $remark"."<br/>";
               }
            }
            else
            {
                echo "The Connection is Error!";
                exit();
            }

        $mysqli->close();
    ?>
    </body>
    </html>

    mysql 设置:

    ALTER DATABASE  test  DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
    ALTER TABLE  table_1 DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

    SET character_set_client='utf8';
    SET character_set_connection='utf8';
    SET character_set_results='utf8';

    php 和mysql 的字符设置必须一样,否则就是乱码

  • 相关阅读:
    redux和react-redux做简单组件控制
    store(转)
    react+redux开发详细步骤
    rudex 实现流程
    react eject 报错
    react生命周期
    python logging
    hihocoder 1754
    hihocoder_offer收割编程练习赛58
    内存检查
  • 原文地址:https://www.cnblogs.com/linsu/p/3469553.html
Copyright © 2011-2022 走看看