Home >php教程 >php手册 >php中创建数据表代码

php中创建数据表代码

WBOY
WBOYOriginal
2016-05-24 13:25:291949browse

<?php
$link = mysql_connect("localhost", "root", "3435945") or die("***" . mysql_error());
echo "成功接连到服务器";
if (mysql_select_db(base2, $link)) echo "选择到base2数据库教程";
$sql = "create table t1(id int(5) not null primary key,name varchar(12) not null)"; //开源代码phprm.com
if (mysql_query($sql, $link)) echo "表T1创建成功";
echo "
";
echo "当前base2数据库上的表有:";
echo "
";
$table_list = mysql_query("show tables", $link);
while ($row = mysql_fetch_row($table_list)) {
    echo $row[0];
    echo "
";
}


永久链接:

转载随意!带上文章地址吧。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn