Desktop Center (III) modify database Source: Aesop
Desktop center (3) modify database
Author: elong
The program below lists the data of that id after you enter the id. Then you can modify the file and write it into it.
Database data update
If (isset ($ id ))
{
If (! Mysql_connect ("localhost", "username", "password "))
{Echo "unable to connect to 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 write
If (! $ Result)
{Echo "error! ";
Exit ();
}
Echo "$ id updated!
";
Echo"
N
N
ID |
$ Id |
N
N
Url |
$ Url |
N
N
Thumbnail |
$ Mess |
N
N
Description |
$ Fromx |
N
N
Url address 1 |
$ Url1 |
N
N
Small |
$ Mess1 |
N
N
Description 1 |
$ Fromx1 |
N
N
Url address 2 |
$ Url2 |
N
N
Small |
$ Mess2 |
N
N
Description 2 |
$ Fromx2 |
N
N
Url 3 |
$ Url3 |
N
N
Small |
$ Mess3 |
N
N
Description 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 "error! ";
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
{?>
Enter the id to be changed: