PHP常用MySql操作方法
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
PHP常用MySql操作方法
PHP常用MySql操作方法
PHP程序开发快,运行快,技术本身学习快。
嵌入于HTML:因为PHP可以被嵌入于HTML语言,它相对于其他语言。
编辑简单,实用性强,更适合初学者。
以下是店铺为大家搜索整理的PHP常用MySql操作方法,欢迎大家阅读!更多相关信息请关注相关栏目!
PHP中常用的几个 mysql 语句
显示数据库或表:
show databases;//然后可以use database_name;
show tables;
更改表名:
alter table table_name rename new_t;
添加列 :
alter table table_name add column c_n column attributes;
删除列:
alter table table_name drop column c_n;
创建索引:
alter table c_table add index (c_n1,c_n2);
alter table c_table add unique index_name(c_n);
alter table c_table add primary key(sid);
删除索引:
alter table c_table drop index c_n1;
更改列信息:
alter table t_table change c_1 c_1 var200);
alter table t_table modify 1 c_1 var200);
插入语句:
into table_name (c_1,c_2)
values (’x1′,1);
update语句:
table_name set c_1 =1 where c_2=3;
删除数据库或者表:
table_name;
drop database database_name;//使用mysql_drop_db()可以删除的.。