桌面中心(三)修改数据库

来源:奥索网 桌面中心(三)修改数据库作者:elong
下面这个程序在你输入id后就把那个id的数据列出来。然后你就可以修改后写入了.
html body h1数据库的数据更新/h1 ? if(isset($id)) {
if(!mysql_connect(localhost,用户名,密码)) {echo无法联接数据库; exit();
} if(isset($url)) { $query=update $jpg set
id=’$id’,url=’$url’,mess=’$mess’,fromx=’$fromx’,url1=’$url1′,mess1=’$mess1′,fromx1=’$fromx1′,url2=’$url2′,mess2=’$mess2′,fromx2=’$fromx2′,url3=’$url3′,mess3=’$mess3′,fromx3=’$fromx3′
where id=’$id’ ; $result=mysql_db_澳门新葡亰手机版,query(elong,$query); //执行写入 if
(!$result) {echo 发生错误!; exit(); } echo $id 已经更新!; echo tablen
trn tdIDtd$id/trn trn tdurl地址td$url/trn trn td小图td$mess/trn trn
td说明td$fromx/trn trn tdurl地址1td$url1/trn trn td小图1td$mess1/trn trn
td说明1td$fromx1/trn trn tdurl地址2td$url2/trn trn td小图2td$mess2/trn
trn td说明2td$fromx2/trn trn tdurl地址3td$url3/trn trn
td小图3td$mess3/trn trn td说明3td$fromx3/trn /tablen; echo a
href=’set.htm’回到首页/a; exit(); } $query=SELECT
id,url,mess,fromx,url1,mess1,fromx1,url2,mess2,fromx2,url3,mess3,fromx3
from $jpg where id=’$id’ ; $result=mysql_db_query(elong,$query); if
(!$result) {echo 发生错误!; exit(); } $r=mysql_fetch_array($result);
$id = $r[id]; $url = $r[url]; $mess = $r[mess]; $fromx =
$r[fromx]; $url1 = $r[url1]; $mess1 = $r[mess1]; $fromx1 =
$r[fromx1]; $url2 = $r[url2]; $mess2 = $r[mess2]; $fromx2 =
$r[fromx2]; $url3 = $r[url3]; $mess3 = $r[mess3]; $fromx3 =
$r[fromx3]; echo form action=’ww.php’ method=’post’n tablen trn
tdID:td input type=text name=’id’ value=’$id’/trn trn td类形:td input
type=text name=’jpg’ value=’$jpg’/trn trn td图片url地址:td input
type=text name=’url’ size=’100′ value=’$url’/trn trn td说明:td input
type=text name=’mess’ size=’100′ value=’$mess’/trn trn td来自:td input
type=text name=’fromx’ size=’100′ value=’$fromx’/trn trn
td图片url地址:td input type=text name=’url1′ size=’100′
value=’$url1’/trn trn td说明:td input type=text name=’mess1′ size=’100′
value=’$mess1’/trn trn td来自:td input type=text name=’fromx1′
size=’100′ value=’$fromx1’/trn trn td图片url地址:td input type=text
name=’url2′ size=’100′ value=’$url2’/trn trn td说明:td input type=text
name=’mess2′ size=’100′ value=’$mess2’/trn trn td来自:td input type=text
name=’fromx2′ size=’100′ value=’$fromx2’/trn trn td图片url地址:td input
type=text name=’url3′ size=’100′ value=’$url3’/trn trn td说明:td input
type=text name=’mess3′ size=’100′ value=’$mess3’/trn trn td来自:td input
type=text name=’fromx3′ size=’100′ value=’$fromx3’/trn /tablen input
type=submit value=’更新’n /formn; } else {? h3请输放需要更改的id:/h3
centerform action=’ww.php’ method=’post’ 动漫桌布 input type=radio
name=jpg value=jpg checked 平分秋色水彩画 input type=radio name=jpg
value=jpg1 明星写真 input type=radio name=jpg value=jpg2 广告创意 input
type=radio name=jpg value=jpg3 其它类 input type=radio name=jpg
value=jpg4 input type=text name=’id’ input type=submit value=’查询’
/form/center ?}? /body /html