怎样用php来创建数据表
打开php的编辑器,写上这个程序的注释内容。
然后新建一个函数create_table
立即学习“PHP免费学习笔记(深入)”;
新建需要连接数据库的变量并赋值。
然后通过mysqli连接数据库。
连接好之后,我们开始写创建数据表的sql语句。
$sql="create table test1( id int(7) unsigned not null auto_increment primary key, username varchar(64) not null, age int(3) not null, register_time timestamp )";
执行sql语句。$connect->query($sql)
调用这个函数。
create_table();
更多PHP知识,请访问PHP教程!
以上就是怎样用php来创建数据表的详细内容,更多请关注php中文网其它相关文章!
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号