华山轮贱

php 数据库insert函数

<?php
    function into($constr)
    {
        $con = mysql_connect("localhost","root","root");
        if (!$con)
          {
          die('Could not connect: ' . mysql_error());
          }

        mysql_select_db("sa", $con);
        mysql_query($constr);
        mysql_close($con);
    } 
      
 //调用实例
    $str="INSERT  INTO  doc (doc_num,doc_name,doc_from,doc_time) VALUES ('2014-3','a test name','','2014/9/25')";
    into($str);

?>

  

posted on 2014-09-25 05:48  华山轮贱  阅读(796)  评论(0编辑  收藏  举报

导航