All articles(网络文学目录) All Pictures(图片目录) All Softwares(软件目录)

 
通过PHP连接MYSQL数据库、创建数据库、创建表_[PHP教程]

Writer: 归海一刀 Article type: Programming skills(编程技巧) Time: 2014/2/17 7:47:58 Browse times: 479 Comment times: 0

通过PHP连接MYSQL数据库、创建数据库、创建表_[PHP教程]


Head photo

Go homepage
Upload pictures
Write articles

通过PHP连接MYSQL数据库、创建数据库、创建表_[PHP教程] 通过PHP连接MYSQL数据库


conn = mysql_connect("localhost","root","password") or die("无法连接数据库");
mysql_select_db("table" ,conn) or die ("找不到数据源");


-----------------------------------------------------------------------
通过PHP创建MYSQL数据库

conn = mysql_connect("localhost","root","password") or die("无法连接数据库");
mysql_create_db("dwww") or die("无法创建数据库");
sqlstr = "create database other_dwww";
mysql_query(sqlstr) or die("无法创建,一般请检查权限什么的");

----------------------------------------------------------------------------
创建mysql的表

conn = mysql_connect("localhost","root","password") or die("无法连接数据库");
mysql_select_db("dwww",conn) or die("无法连接数据库dwww");
sql = "create table dwww_table(
ids integer not null auto_increment ,
primary key(ids)
)";
mysql_query(sql) or die(mysql_error());




There are 0 records,
Comment:
Must be registered users to comment(必须是注册用户才能发表评论)

Disclaimer Privacy Policy About us Site Map
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.