Notes | data | database
<?php
$conn = mysql_connect ("127.0.0.1", "Root", ""); Connecting to the MySQL database
mysql_select_db ("temp"); Select Database
$exec = "SELECT * from Wind"; Select data table
$result = mysql_query ($exec); Execution record
while ($rs =mysql_fetch_object ($result))
{
echo "Name:". $rs->name. " <Br> ";/= Rs.name
echo "Tel:". $rs->tel. " <Br> ";
echo "Address:" $rs->addr. " <br><BR> ";
}
?>
<form method= "POST" action= "day22.php" >
User name: <input type= ' text ' name= ' name ' ><br>
Tel: <input type= ' text ' name= ' Tel ' ><Br>
Address: <input type= ' text ' name= ' addr ' ><BR>
<input type= ' Submit ' value= ' submitted ' ><BR><BR>
</form>
======== Processing page
<?php
$conn = mysql_connect ("127.0.0.1", "Root", ""); Connecting to the MySQL database
mysql_select_db ("temp"); Select Database
$sql = INSERT INTO Wind (NAME,TEL,ADDR) VALUES ('. $_post[' name '). "', '". $_post[' Tel ']. "', '". $_post[' addr '].
Delete, modify only $sql statement can be changed
Delete $sql = "Delete from wind where ..."
Modify $sql = "Update wind set item1= '". $_post[' item1 '. "' Where ... ';
$rs 1 = mysql_query ($sql);
echo "Data insertion success!" ";
echo "<script>location.href (' day2.php ');</script>";
?>