zoukankan      html  css  js  c++  java
  • php :: mysql

     

    mysql_php 大全

    <?php
        $con = mysql_connect("localhost", "root", "dami");
        if(!$con)
        {
            die('不能连接到指定数据库');
        }
        mysql_select_db("lesson", $con);
        //mysql_query("insert into student values(226,'书籍',26,'this is description')");
        //mysql_query("update student set des = 'the des of joan' where id = 2");
        //mysql_query("delete from student where id = 226");
        $result = array();
        $result_temp = mysql_query("select * from student");
        while($row = mysql_fetch_array($result_temp))
            $result[] = $row;
        //print_r($result);
        foreach($result as $index => $student)
        {
            echo "$index 
    ";
            print_r($student);
            echo "
    ";
        }
        //var_dump($result);
        mysql_close($con);
    ?>

    $con = mysql_connect("localhost", "root", "abc123");    //建立数据库连接

    mysql_select_db("db_name", $con);                                       //选择数据库

    mysql_query("select * from student", $con);        // 数据库查询

    mysql_query("insert into student(id,name) values(2,'student_one_name')");   //插入数据

    //mysql_query获取的数据处理

    while($row = mysql_fetch_array($result))

      $result[] = $row;

    mysql_close($con);                  //数据库连接关闭

    修改列属性默认值: alter table t_sap_account_history alter column check_status set default 0

  • 相关阅读:
    js 右击
    javascript 中的函数,控制流, 事件委托
    javascript 的 this , js 线程
    javascript 中的var : 隐含变量 全局变量 变量提升
    明日
    ajax循环json 中的 for(var prop in data) 与 hasProperty()
    js继承机制
    callee, caller,toString(),String()
    解决eclipse中jsp下无代码提示问题
    商业模式
  • 原文地址:https://www.cnblogs.com/maxiaoshuai/p/6824924.html
Copyright © 2011-2022 走看看