PHP Desktop Center (iii) modify database _php instance
Last Update:2017-01-18
Source: Internet
Author: User
The following program lists the data for that ID after you enter the ID. Then you can modify it and write it.
<body>
Data Update ?
if (Isset ($id))
{
if (!mysql_connect ("localhost", "username", "password"))
{echo "Cannot join database";
Exit ();
}
if (Isset ($url))
{
$query = "Update $jpg set id= ' $id ', url= ' $url ', mess= ' $mess ',
fromx= ' $fromx ', url1= ' $url 1 ', mess1= ' $mess 1 ', fromx1= ' $FROMX 1 ', url2= ' $url 2 ',
Mess2= ' $mess 2 ', fromx2= ' $fromx 2 ', url3= ' $url 3 ', mess3= ' $mess 3 ', fromx3= ' $fromx 3 '
where id= ' $id ';
$result =mysql_db_query ("elong", $query); Execute Write
if (! $result)
{echo "Error!";
Exit ();
}
echo "$id has been updated!<br><br>";
echo "<table>n
<tr>n
<td>ID<td> $id </tr>n
<tr>n
<td>url address <td> $url </tr>n
<tr>n
<td> Small map <td> $mess </tr>n
<tr>n
<td> Description <td> $fromx </tr>n
<tr>n
<td>url address 1<td> $url 1</tr>n
<tr>n
<td> Small map 1<td> $mess 1</tr>n
<tr>n
<td> Description 1<td> $fromx 1</tr>n
<tr>n
<td>url address 2<td> $url 2</tr>n
<tr>n
<td> Small map 2<td> $mess 2</tr>n
<tr>n
<td> Description 2<td> $fromx 2</tr>n
<tr>n
<td>url address 3<td> $url 3</tr>n
<tr>n
<td> Small map 3<td> $mess 3</tr>n
<tr>n
<td> Description 3<td> $fromx 3</tr>n
</table>n ";
echo "<a href= ' set.htm ' > Back home </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 "Error!";
Exit ();
}
$r =mysql_fetch_array ($result);
$id = $r ["id"];
$url = $r ["url"];
$mess = $r ["mess"];
$FROMX = $r ["FromX"];
$url 1 = $r ["URL1"];
$mess 1 = $r ["Mess1"];
$FROMX 1 = $r ["Fromx1"];
$url 2 = $r ["Url2"];
$mess 2 = $r ["Mess2"];
$FROMX 2 = $r ["FROMX2"];
$url 3 = $r ["Url3"];
$mess 3 = $r ["MESS3"];
$FROMX 3 = $r ["Fromx3"];
Echo
<form action= ' ww.php ' method= ' post ' >n
<table>n
<tr>n
<td>ID:<td> <input type=text name= ' ID ' value= ' $id ' ></tr>n
<tr>n
<td> class:<td> <input type=text name= ' jpg ' value= ' $jpg ' ></tr>n
<tr>n
<td> image URL address:<td> <input type=text name= ' url ' size= ' value= ' $url ' ></tr>n
<tr>n
<td> description:<td> <input type=text name= ' mess ' size= ' value= ' $mess ' ></tr>n
<tr>n
<td> from:<td> <input type=text name= ' fromx ' size= ' value= ' $fromx ' ></tr>n
<tr>n
<td> image URL address:<td> <input type=text name= ' url1 ' size= ' value= ' $url 1 ' ></tr>n
<tr>n
<td> description:<td> <input type=text name= ' mess1 ' size= ' value= ' $mess 1 ' ></tr>n
<tr>n
<td> from:<td> <input type=text name= ' fromx1 ' size= ' ' value= ' $FROMX 1 ' ></tr>n
<tr>n
<td> image URL address:<td> <input type=text name= ' url2 ' size= ' value= ' $url 2 ' ></tr>n
<tr>n
<td> description:<td> <input type=text name= ' mess2 ' size= ' value= ' $mess 2 ' ></tr>n
<tr>n
<td> from:<td> <input type=text name= ' fromx2 ' size= ' ' value= ' $fromx 2 ' ></tr>n
<tr>n
<td> image URL address:<td> <input type=text name= ' url3 ' size= ' value= ' $url 3 ' ></tr>n
<tr>n
<td> description:<td> <input type=text name= ' mess3 ' size= ' value= ' $mess 3 ' ></tr>n
<tr>n
<td> from:<td> <input type=text name= ' fromx3 ' size= ' ' value= ' $fromx 3 ' ></tr>n
</table>n
<input type=submit value= ' Update ' >n
</form>n ";
}
Else
{?>
<center><form action= ' ww.php ' method= ' post ' >
<br>
Anime Tablecloth
<input type= "Radio" name= "jpg" value= "jpg" checked>
Watercolor painting
<input type= "Radio" name= "JPG" value= "JPG1" >
Star photo
<input type= "Radio" name= "JPG" value= "JPG2" >
Advertising Creative
<input type= "Radio" name= "JPG" value= "jpg3" >
Other classes
<input type= "Radio" name= "JPG" value= "jpg4" >
<br>
<input type=text name= ' id ' >
<input type=submit value= ' Enquiry ' >
</form></center>
?? >
</body>