Desktop Center (ii) database write _php Basics

Source: Internet
Author: User
Tags password protection
Source: Osso Network

Desktop Center (ii) database write
Author: elong

One, the following is the database write HTML program, you can add password function. Make the password into a variable and send it to the PHP program written below. This enables password protection:
<title> Database </title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<style type= "Text/css" >
<!--
. p9 {FONT-SIZE:9PT}
-->
</style>

<body bgcolor= "#FFFFFF" >
<div align= "center" >
<p class= "P9" > Database management Program



<a href= "mysql.php" > View database Data </a></p>
<p class= "P9" ><a href= "ww.php" > Change data </a>

</p>
<form method= "POST" action= "wsql.php" >
<p align= "left" ><span class= "p9" > Image URL Address
<input type= "text" name= "url" size= ">"




Picture Small figure
<input type= "text" name= "mess" size= ">"




Description
<input type= "text" name= "FromX" size= ">"
</span></p>
<p align= "left" ><span class= "p9" > Image URL address 1
<input type= "text" name= "URL1" size= ">"




Picture Small Figure 1
<input type= "text" name= "Mess1" size= ">"




Description 1
<input type= "text" name= "fromx1" size= ">"
</span></p>
<p align= "left" ><span class= "p9" > Image URL address 2
<input type= "text" name= "Url2" size= ">"




Picture Small Figure 2
<input type= "text" name= "Mess2" size= ">"




Description 2
<input type= "text" name= "FROMX2" size= ">"
</span></p>
<p align= "left" class= "P9" ><span class= "p9" > Image URL address 3
<input type= "text" name= "Url3" size= ">"




Picture Small Figure 3
<input type= "text" name= "MESS3" size= ">"




Description 3
<input type= "text" name= "fromx3" size= ">"
</span>



Watercolor painting
<input type= "Radio" name= "jpg" value= "jpg" checked>


Star photo
<input type= "Radio" name= "JPG" value= "JPG1" >


Anime Tablecloth
<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" >




<input type= "Submit" name= "Submission" value= "submitted" >


</p>
</form>
</div>
</body>

Second, then the processing of this submitted PHP program:
<body>
Data ?
mysql_connect ("localhost", "username", "password") or Die ("Cannot join database!");
$query = "INSERT into $jpg values (' $id ', ' $url ', ' $mess ', ' $fromx ', ' $url 1 ', ' $mess 1 ', ' $FROMX 1 ', ' $url 2 ', ' $mess 2 ', ' $ Fromx2 ', ' $url 3 ', ' $mess 3 ', ' $fromx 3 ');
$result =mysql_db_query ("elong", $query); Execute Write

if (Mysql_affected_rows () ==1)
{
echo "Data has been added to the database $jpg

";
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 ";
}
else echo "System is out of the question, please try again!:(";
Mysql_close ();
?>
<a href= ' set.htm ' > Back home </a>
</body>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.