mysql
成都創(chuàng)新互聯(lián)-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設、高性價比新民網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式新民網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設找我們,業(yè)務覆蓋新民地區(qū)。費用合理售后完善,十多年實體公司更值得信賴。
有一個默認的數(shù)據(jù)庫,叫做information_schema
連上這個庫,執(zhí)行下面的語句(你自己那可能的改下下面的sql)
//table_schema
是你的數(shù)據(jù)庫名字
table_name是表名
select
*
from
tables
where
table_schema
=
'storage'
and
table_name
like
'product%'
你看看庫中這個表結(jié)構(gòu)就明白了,呵呵
$dbh是new PDO()
$dbh-exec("show tables");--獲取所有表#
$dbh-exec("desc 表名");--查詢表結(jié)構(gòu)
?php
$servername?=?"localhost";
$username?=?"root";
$password?=?"password";//你的mysql密碼
$dbname?=?"myDB";//選擇數(shù)據(jù)庫
//?創(chuàng)建連接
$conn?=?new?mysqli($servername,?$username,?$password,?$dbname);
//?檢測連接
if?($conn-connect_error)?{
die("Connection?failed:?"?.?$conn-connect_error);
}?
$sql?=?"SELECT?id,?firstname,?lastname?FROM?MyGuests";
$result?=?$conn-query($sql);
if?($result-num_rows??0)?{
//?輸出每行數(shù)據(jù)
while($row?=?$result-fetch_assoc())?{
echo?"br?id:?".?$row["id"].?"?-?Name:?".?$row["firstname"].?"?"?.?$row["lastname"];
}
}?else?{
echo?"0?results";
}
$conn-close();
?
當前文章:php表連接查詢數(shù)據(jù)庫名 php如何查詢數(shù)據(jù)庫
網(wǎng)頁地址:http://chinadenli.net/article22/hjjsjc.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供微信公眾號、網(wǎng)站設計公司、關鍵詞優(yōu)化、面包屑導航、營銷型網(wǎng)站建設、服務器托管
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)