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

php中创建数据表代码

WBOY
Release: 2016-05-24 13:25:29
Original
1970 people have browsed it

<?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 "
";
}
Copy after login


永久链接:

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template