2016-12-18 · 知道合伙人互联网行家
关注
展开全部
<?php$server = "localhost";
$username = "root";
$password = "";
$database = "myabc";
$ranks = array(
1=>"newbie",
2=>"new member",
3=>"member",
4=>"high member",
5=>"very high member",
6=>"supreme member",
7=>"ultra member",
8=>"godlike member",
9=>"god member",
10=>"low god",
11=>"medium god",
12=>"high god",
13=>"very high god",
14=>"supreme god",
15=>"ultra god",
16=>"perfect");$couldNotOpenDatabase = "Could not open database<BR>\n please check your settings in config.php";
$couldNotConnectMysql="Could not connect Mysql!";
$conn=mysql_connect($server,$username,$password) or die ($couldNotConnectMysql);
if (mysql_select_db($database,$conn))
{//数据库存在,做相应操作}else{//数据库不存在,创建一个,并做相应操作
$username = "root";
$password = "";
$database = "myabc";
$ranks = array(
1=>"newbie",
2=>"new member",
3=>"member",
4=>"high member",
5=>"very high member",
6=>"supreme member",
7=>"ultra member",
8=>"godlike member",
9=>"god member",
10=>"low god",
11=>"medium god",
12=>"high god",
13=>"very high god",
14=>"supreme god",
15=>"ultra god",
16=>"perfect");$couldNotOpenDatabase = "Could not open database<BR>\n please check your settings in config.php";
$couldNotConnectMysql="Could not connect Mysql!";
$conn=mysql_connect($server,$username,$password) or die ($couldNotConnectMysql);
if (mysql_select_db($database,$conn))
{//数据库存在,做相应操作}else{//数据库不存在,创建一个,并做相应操作
追问
菜鸟一个 看不懂啊
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询