初學者寫的,你可以試試
發展壯大離不開廣大客戶長期以來的信賴與支持,我們將始終秉承“誠信為本、服務至上”的服務理念,堅持“二合一”的優良服務模式,真誠服務每家企業,認真做好每個細節,不斷完善自我,成就企業,實現共贏。行業涉及成都水電改造等,在重慶網站建設公司、成都全網營銷推廣、WAP手機網站、VI設計、軟件開發等項目上具有豐富的設計經驗。
form?name="myform"?method="post"?action="mysql.php"
table?border="1"
tr
td?width="605"?height="51"?bgcolor="#CC99FF"?colspan="2"
div?align="center"請輸入用戶名稱
input?name="txt_user"?type="text"?id="txt_user"?size="25"nbsp;
input?type="submit"?name="Submit"?value="查詢"
/div
/td
/tr
tr
td?align='center'用戶名稱/td
td?align='center'年齡/td
/tr
?php
//?mysql_connect(服務器,用戶名,密碼)
$link?=?mysql_connect("localhost","root","root");
//?mysql_select_db(數據庫,$link)
$db_selected?=?mysql_select_db("php_test",$link);
//?編碼格式(貌似很重要)
mysql_query("set?names?'utf8'");
?
?php
$sql?=?mysql_query("select?name_,age_?from?t_user");
$info?=?mysql_fetch_array($sql);
if($_POST[Submit]=="查詢"){
$txt_user?=?$_POST[txt_user];
$sql?=?mysql_query("select?*?from?t_user?where?name_?like?'%".trim($txt_user)."%'");
$info?=?mysql_fetch_array($sql);
}
?
?php
if($info==false){
echo?'trtd?width="605"?height="51"?bgcolor="#CC99FF"?colspan="2"';
echo?"div?align='center'?style='color:#FF0000;font-size:12px;'對不起,您查找的用戶信息不存在!/div";
echo?'/td/tr';
}elseif($info){
echo?'elseif';
}
?
?php
do{
?
tr?align="center"?bgcolor="#FFFFFF"
td?height="20"align="center"??php?echo?$info['NAME_']?/td
td??php?echo?$info['AGE_']?/td
/tr
?php
}while($info?=?mysql_fetch_array($sql));
mysql_free_result($sql);
mysql_close($link);
?
/table
/form
獲取ppq數據庫的所有表名的代碼:
?php
$server='localhost';
$user='root';
$pass='12345';
$dbname='ppq';
$conn=mysql_connect($server,$user,$pass);
if(!$conn)
die("數據庫系統連接失敗!");
$result=mysql_list_tables($dbname);
if(!$result)
die("數據庫連接失敗!");
while($row=mysql_fetch_row($result))
{
echo
$row[0]."
";
}
mysql_free_result($result);
?
mysql_list_tables
(PHP
3,
PHP
4
,
PHP
5)
mysql_list_tables
--
列出
MySQL
數據庫中的表
說明
resource
mysql_list_tables
(
string
database
[,
resource
link_identifier])
mysql_list_tables()
接受一個數據庫名并返回和
mysql_query()
函數很相似的一個結果指針。用
mysql_fetch_array()或者用mysql_fetch_row()來獲得一個數組,數組的第0列就是數組名,當獲取不到時
mysql_fetch_array()或者用mysql_fetch_row()返回
FALSE。
這個簡單啊!
首頁做個前臺輸入姓名和會員卡信息的頁面,我做個簡單的頁面給你看
!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會員查詢系統/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","數據庫用戶名","數據庫密碼");
if?(!$con)
{
die('Could?not?connect:?'?.?mysql_error());
}
$a????=????mysql_select_db("數據庫名字",?$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);
?
頁面美化自己去搞!只能幫你這么多了