PHP中常用的幾個(gè) mysql 語句_PHP教程
教程Tag:暫無Tag,歡迎添加,賺取U幣!
推薦:怎樣通過PHP連接MYSQL數(shù)據(jù)庫、創(chuàng)建數(shù)據(jù)庫、創(chuàng)建表通過PHP連接MYSQL數(shù)據(jù)庫 conn = mysql_connect(localhost,root,password) or die(無法連接數(shù)據(jù)庫); mysql_select_db(table ,conn) or die (找不到數(shù)據(jù)源); ----------------------------------------------------------------------- 通過PHP創(chuàng)
PHP中常用的幾個(gè) mysql 語句顯示數(shù)據(jù)庫或表:
show databases;//然后可以u(píng)se 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;
創(chuàng)建索引:
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 varchar(200);
alter table t_table modify 1 c_1 varchar(200);
insert插入語句:
insert into table_name (c_1,c_2)
values ('x1',1);
update語句:
update table_name set c_1 =1 where c_2=3;
刪除數(shù)據(jù)庫或者表:
drop table table_name;
drop database database_name;//使用mysql_drop_db()可以刪除的.
show databases;//然后可以u(píng)se 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;
創(chuàng)建索引:
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 varchar(200);
alter table t_table modify 1 c_1 varchar(200);
insert插入語句:
insert into table_name (c_1,c_2)
values ('x1',1);
update語句:
update table_name set c_1 =1 where c_2=3;
刪除數(shù)據(jù)庫或者表:
drop table table_name;
drop database database_name;//使用mysql_drop_db()可以刪除的.
分享:如何實(shí)現(xiàn)文件上傳的程序源碼如何實(shí)現(xiàn)文件上傳 ? HTML HEAD TITLE文件上傳界面/TITLE /HEAD BODYTABLECENTER ? if(UploadAction){ UploadAction=0; TimeLimit=60; /*設(shè)置超時(shí)限制時(shí)間默認(rèn)時(shí)間為 30s,設(shè)置為0時(shí)為不限時(shí) */ set_time_limit(TimeLimit); If((Upfile != none) (Upfile !=
相關(guān)PHP教程:
- PHPNOW安裝Memcached擴(kuò)展方法詳解
- php記錄頁面代碼執(zhí)行時(shí)間
- PHP中獎(jiǎng)概率的抽獎(jiǎng)算法程序代碼
- apache設(shè)置靜態(tài)文件緩存方法介紹
- php對(duì)圖像的各種處理函數(shù)代碼小結(jié)
- PHP 關(guān)于訪問控制的和運(yùn)算符優(yōu)先級(jí)介紹
- 關(guān)于PHP語言構(gòu)造器介紹
- php/js獲取客戶端mac地址的實(shí)現(xiàn)代碼
- php5.5新數(shù)組函數(shù)array_column使用
- PHP preg_match的匹配多國(guó)語言的技巧
- php 中序列化和json使用介紹
- php采集文章中的圖片獲取替換到本地
- 相關(guān)鏈接:
- 教程說明:
PHP教程-PHP中常用的幾個(gè) mysql 語句
。