欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

php怎么添加數(shù)據(jù)字段 php向mysql添加數(shù)據(jù)

用PHP怎么給數(shù)據(jù)庫的表中添加字段

mysql_connect('地址','用戶名','密碼');

網(wǎng)站建設(shè)哪家好,找創(chuàng)新互聯(lián)!專注于網(wǎng)頁設(shè)計(jì)、網(wǎng)站建設(shè)、微信開發(fā)、微信平臺(tái)小程序開發(fā)、集團(tuán)企業(yè)網(wǎng)站建設(shè)等服務(wù)項(xiàng)目。為回饋新老客戶創(chuàng)新互聯(lián)還提供了湛河免費(fèi)建站歡迎大家使用!

mysql_select_db('數(shù)據(jù)庫名');

$sql = "ALTER TABLE `表名` ADD `列名` 數(shù)據(jù)類型";

mysql_query($sql);

請(qǐng)問一下php的pdo如何插入一個(gè)新字段?謝謝了!

?php

$config = [

'user' = 'root',

'passwd' = 'root',

];

try {

$db = new PDO('mysql:host=172.17.0.1;port=3306;dbname=test', $config['user'], $config['passwd']);

# 新建一張表 A

$db-exec('create table if not exists A (

id int unsigned not null primary key auto_increment comment \'主鍵id\'

);');

# 給表 A 新增一個(gè)字段 name

$db-exec('alter table A add column name varchar(50) not NULL default \'\' comment \'名稱\';');

} catch (PODException $e) {

print("Error: " . $e-getMessage());

exit();

}

Thinkphp 怎樣添加數(shù)據(jù)表的字段

直接修改數(shù)據(jù)庫就行了。或者你自己寫alter table語句執(zhí)行一下也可以。thinkphp并沒有內(nèi)置這種功能。

分享文章:php怎么添加數(shù)據(jù)字段 php向mysql添加數(shù)據(jù)
分享地址:http://www.chinadenli.net/article8/doojdop.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站制作App設(shè)計(jì)商城網(wǎng)站用戶體驗(yàn)網(wǎng)站設(shè)計(jì)公司自適應(yīng)網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

營銷型網(wǎng)站建設(shè)