幫你簡單的做了一下,剩下的你自己搞定。。。

創(chuàng)新互聯(lián)公司2013年開創(chuàng)至今,先為靈山等服務(wù)建站,靈山等地企業(yè),進行企業(yè)商務(wù)咨詢服務(wù)。為靈山企業(yè)網(wǎng)站制作PC+手機+微官網(wǎng)三網(wǎng)同步一站式服務(wù)解決您的所有建站問題。
這個是你的那段代碼,然后我用了jquery的ajax?你自己去下一個。這個是index.php
?php
header("Content-type: text/html; charset=utf-8");
include './config.php';
$sql="select * from `xj_2009`";
$query = mysql_query($sql);
$row = mysql_fetch_array($query);
?
script src="./jquery-1.6.2.min.js"/script
script
function GetNext(id){
$.get("test.php", { sid: id},
function(data){
alert("Data Loaded: " + data);
});
}
/script
form action="ss.php" method="post"br
ID:input type="text" name="id" value="?php echo $row["id"]?" /brbr
用戶名:input type="text" name="username" value="?php echo $row["name"]?" /brbr
input type="button" name="next" onclick="GetNext(?php echo $row["id"]?)" value="下一條"/
/form
下面這個是ajax請求的頁面test.php?
?php
include './config.php';
$sql="select * from `xj_2009` where id {$_GET['sid']} limit 1";
$query = mysql_query($sql);
$row = mysql_fetch_array($query,MYSQL_ASSOC);
$jsonencode = json_encode($row);
echo $jsonencode;
?
已經(jīng)可以獲取到返回的json值了,剩下的你自己搞定。。
你應(yīng)該把id用GET方式傳遞過去,也就是說上面代碼改為:onclick="window.location.href='?php echo "/edit.php?id=".$row['id'];?,然后在edit.php接收
?php
$id?=?$_GET['id'];
$sql?=?"select?*?from?yourtable?where?id?=?{$id}";
?
如果不刷新,就用ajax去取數(shù)據(jù),回來在顯示出來
當(dāng)然也可以點擊按鈕到別的頁面上去,去取數(shù)據(jù)。
你數(shù)據(jù)庫的數(shù)據(jù),必須有一個字段用來存儲日期的,取的時候,判斷當(dāng)前日期與數(shù)據(jù)庫的日期,如果在一個月內(nèi)的,就取出來。
本文標(biāo)題:PHP通過按鈕上一條數(shù)據(jù) php通過按鈕上一條數(shù)據(jù)輸出
文章來源:http://chinadenli.net/article8/dojjoop.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站制作、做網(wǎng)站、品牌網(wǎng)站建設(shè)、網(wǎng)站建設(shè)、關(guān)鍵詞優(yōu)化、ChatGPT
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)