- 论坛徽章:
- 0
|
下面这段代码是在TEST数据库里建立一个REGUSER的表,用PHPMYADMIN没问题,可是用这段代码保存为PHP时就不行了 老是出错,那位大哥费点心帮忙看一下 谢谢
<?php
$myconn=mysql_connect("localhost","root",""
if(!@mysql_select_db(test,$myconn)) {
// Inform user of error and exit
print "# Couldn't select database <br>;\n";
exit;
} else {
// Inform user of success
print "# Database selected successfully <br>;\n";
}
$sql1="CREATE TABLE reguser ( id int(11) not null AUTO_INCREMENT,
userid char(20) not null default '',
sex char(2) not null default '',
age smallint(6) not null default '',
tel char(20)) not null default '',
email char(50) not null default '',
address char(10) not null default '',
PRIMARY KEY (id)
) ";
if (mysql_query($sql1)=="1"
{
echo "<p align=center>;数据库初始化...............<font color=#ff0000>;成功</font>;</p>;<br>;";
}
else
{
echo "<p align=center>;数据库初始化...............<font color=#ff0000>;失败</font>;</p>;<br>;";
exit;
}
?>; |
|