這個簡單?。?/p>
我們提供的服務有:成都做網(wǎng)站、網(wǎng)站制作、微信公眾號開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認證、慶陽ssl等。為1000多家企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務,是有科學管理、有技術的慶陽網(wǎng)站制作公司
首頁做個前臺輸入姓名和會員卡信息的頁面,我做個簡單的頁面給你看
!DOCTYPE?html?PUBLIC?"-//W3C//DTD?XHTML?1.0?Transitional//EN"?"
html?xmlns="
head
meta?http-equiv="Content-Type"?content="text/html;?charset=utf-8"?/
title會員查詢系統(tǒng)/title
/head
body
form?id="form1"?name="form1"?method="post"?action="test.php"
p
label?for="name"/label
input?type="text"?name="name"?id="name"?/
/p
p
label?for="vipid"/label
input?type="text"?name="vipid"?id="vipid"?/
/p
p
input?type="submit"?name="button"?id="button"?value="查詢"?/
/p
/form
/body
/html
然后我給你一個test.php的文件代碼:
?php
$name????=????trim($_POST['name']);
$vipid????=????trim($_POST['vipid']);
$con?=?mysql_connect("127.0.0.1","數(shù)據(jù)庫用戶名","數(shù)據(jù)庫密碼");
if?(!$con)
{
die('Could?not?connect:?'?.?mysql_error());
}
$a????=????mysql_select_db("數(shù)據(jù)庫名字",?$con);
$sql????=????"select?*?from?kh_customer?where?name?=?'$name'?and?vipid?=?'$vipid'";
$result?=?mysql_query($sql);
while($row?=?mysql_fetch_array($result))
{
echo?$row['name']?.?"?"?.?$row['data'];
echo?"br?/";
}
mysql_close($con);
?
頁面美化自己去搞!只能幫你這么多了
你的表與表之間有沒有關聯(lián)?
如果有關聯(lián)的話,,可以寫成一個SQL語句
將查詢結果賦予一個數(shù)組
然后遍歷數(shù)據(jù)
將遍歷結果 賦在指定的位置中 就實現(xiàn)了你的功能
沒這么干過 mysql_list_tables 獲取 所有表信息 返回指針 mysql_tablename 獲取表名
myslq_num_rows函數(shù)來判斷結果指針中的表的數(shù)目
?php
mysql_connect("localhost", "mysql_user", "mysql_password");
$result = mysql_list_tables("mydb");
for ($i = 0; $i mysql_num_rows($result); $i++)
printf ("Table: %s\n", mysql_tablename($result, $i));
mysql_free_result($result);
? 這是手冊上例子 后邊的不用我說了吧 sql查詢
可以用下面的代碼查看數(shù)據(jù)庫中數(shù)據(jù)表是否存在:
$con = mysql_connect("localhost","$username","$password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("$datebase_name", $con);
$result = mysql_query("SELECT * FROM your_table");
while($row = mysql_fetch_array($result))
{ if(!$row){ echo "表不存在!"; } else{ echo "表存在!"; }
}
mysql_close($con);
首先,向你介紹一下information_schema。
information_schema這張數(shù)據(jù)表保存了MySQL服務器所有數(shù)據(jù)庫的信息。如數(shù)據(jù)庫名,數(shù)據(jù)庫的表,表欄的數(shù)據(jù)類型與訪問權限等。再簡單點,這臺MySQL服務器上,到底有哪些數(shù)據(jù)庫、各個數(shù)據(jù)庫有哪些表,每張表的字段類型是什么,各個數(shù)據(jù)庫要什么權限才能訪問,等等信息都保存在information_schema表里面。
所以,你需要查表信息應該去這個庫查
sql語句是
select * from information_schema.tables where table_schema='dbname';
希望采納,祝您愉快!
mysqli寫在一個單獨的文件中, 作為整站的核心文件, 比如名稱是:conn.php
那么在你需要數(shù)據(jù)庫操作的頁面include進來
比如:
?php
include?'conn.php';?//將數(shù)據(jù)庫連接文件包括進來
//這下面就可以進行mysqli函數(shù)操作了!
網(wǎng)站名稱:php查看數(shù)據(jù)庫中的表 php查詢sql數(shù)據(jù)并顯示
文章轉載:http://aaarwkj.com/article36/hhjjpg.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供App開發(fā)、關鍵詞優(yōu)化、網(wǎng)站導航、App設計、服務器托管、企業(yè)建站
聲明:本網(wǎng)站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)