Source: Aosuo.com
Desktop Center (3) Modify Database
Author: elong
The following program will list the data of that id after you enter the id.Then you can modify and write.
Data update of database
if (isset($id))
{
if(!mysql_connect("localhost","username","password"))
{echo "Unable to connect to the database";
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); //Execute writing
if (!$result)
{echo "An error occurred!";
exit();
}
echo "$ id has been updated!
";
echo "
n
n
ID | $id |
n
n
url address | $url |
n
n
small picture | $mess< /tr>n
|
n
Description | $fromx |
n
n
url address 1< td>$url1 |
n
n
Picture 1 | $mess1 |
n
n
< td>Description 1$fromx1 |
n
n
url address 2 | $url2 |
n
n
Picture 2 | $mess2 |
n
n
Description 2 | $fromx2 |
n
n
url address 3 | $url3 |
n
n
Picture 3 | $mess3 tr>n
|
n
Instruction 3 | $fromx3 |
n
n";
echo "
Back to homepage";
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 "An error occurred!";
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"
n";
}
else
{?>
请输放需要更改的id:
}?>
http://www.bkjia.com/PHPjc/315240.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/315240.htmlTechArticle来源:奥索网 桌面中心(三)修改数据库 作者:elong 下面这个程序在你输入id后就把那个id的数据列出来。然后你就可以修改后写入了. html b...