php向数据库中插入表

作者:fly 发布于:2014-2-1 17:34 分类:discuz

<?php  
 $con=mysql_connect("localhost","root","111");  
 if($con)  
  {  
      echo "连接成功!";  
  }  
  else  
  {  
    die('Could not connect: ' . mysql_error());  
  }   
  mysql_select_db("liyongquan_db",$con);  
  $sql="CREATE TABLE Persons  
                           (  
    personID int NOT NULL AUTO_INCREMENT,  
    PRIMARY KEY(personID),  
    FirstName varchar(15),  
    LastName varchar(15),   
    Age int  
                            )";  
   mysql_query($sql,$con);  
   mysql_close($con);  
?>  

发表评论:

 
Powered by emlog sitemap