PHP中常用的幾個(gè) mysql 語(yǔ)句_PHP教程
教程Tag:暫無(wú)Tag,歡迎添加,賺取U幣!
推薦:怎樣通過(guò)PHP連接MYSQL數(shù)據(jù)庫(kù)、創(chuàng)建數(shù)據(jù)庫(kù)、創(chuàng)建表通過(guò)PHP連接MYSQL數(shù)據(jù)庫(kù) conn = mysql_connect(localhost,root,password) or die(無(wú)法連接數(shù)據(jù)庫(kù)); mysql_select_db(table ,conn) or die (找不到數(shù)據(jù)源); ----------------------------------------------------------------------- 通過(guò)PHP創(chuàng)
PHP中常用的幾個(gè) mysql 語(yǔ)句顯示數(shù)據(jù)庫(kù)或表:
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插入語(yǔ)句:
insert into table_name (c_1,c_2)
values ('x1',1);
update語(yǔ)句:
update table_name set c_1 =1 where c_2=3;
刪除數(shù)據(jù)庫(kù)或者表:
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插入語(yǔ)句:
insert into table_name (c_1,c_2)
values ('x1',1);
update語(yǔ)句:
update table_name set c_1 =1 where c_2=3;
刪除數(shù)據(jù)庫(kù)或者表:
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記錄頁(yè)面代碼執(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語(yǔ)言構(gòu)造器介紹
- php/js獲取客戶端mac地址的實(shí)現(xiàn)代碼
- php5.5新數(shù)組函數(shù)array_column使用
- PHP preg_match的匹配多國(guó)語(yǔ)言的技巧
- php 中序列化和json使用介紹
- php采集文章中的圖片獲取替換到本地
PHP教程Rss訂閱編程教程搜索
PHP教程推薦
- 最好用的PHP數(shù)據(jù)庫(kù)操作類-ezSQL
- PHP 過(guò)濾頁(yè)面中的BOM(實(shí)現(xiàn)代碼)
- 解析PHP如何透過(guò)ODBC來(lái)存取數(shù)據(jù)庫(kù)
- 揭秘PHP動(dòng)態(tài)網(wǎng)站開發(fā)中常用的8個(gè)小技巧
- 使用Xdebug優(yōu)化你的php程序
- PHP6將實(shí)現(xiàn)的幾個(gè)功能
- PHP靜態(tài)調(diào)用非靜態(tài)方法的應(yīng)用分析
- 最完整的PHP.INI中文詳細(xì)配置指南
- PHP操作文件類實(shí)例代碼
- 揭秘php程序獲得訪問者ip的代碼
- 相關(guān)鏈接:
- 教程說(shuō)明:
PHP教程-PHP中常用的幾個(gè) mysql 語(yǔ)句。