Php應用實例--新增資料錄到MySQL資料表

發表于:2007-05-25來源:作者:點擊數: 標簽:MySQLphp應用新增實例
一,Insert.htm源碼: html head meta http-equiv=Content-Type content=text/html; charset=gb2312 titleInsert/title /head body pScore資料表--新增資料錄 /p phr noshade/p form name=form1 method=post action=insert.htm table width=200 border=0 ali

一,Insert.htm源碼:

clearcase/" target="_blank" >cc6600"><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Insert</title>
</head>

<body>
<p>Score資料表--新增資料
</p>
<p><hr noshade></p>
              <form name="form1" method="post" action="insert.htm">
                <table width="200" border="0" align="center">
                  <tr>
                    <td>Number</td>
                    <td><input type="text" name="Number"></td>
                  </tr>
                  <tr>
                    <td>Name</td>
                    <td><input type="text" name="Name"></td>
                  </tr>
                  <tr>
                    <td>Chinese</td>
                    <td><input type="text" name="Chinese"></td>
                  </tr>
                  <tr>
                    <td>English</td>
                    <td><input type="text" name="English"></td>
                  </tr>
                  <tr>
                    <td>Math</td>
                    <td><input type="text" name="Math"></td>
                  </tr>
                  <tr>
                    <td><input type="submit" name="Submit" value="提交"></td>
                    <td>&nbsp;</td>
                  </tr>
                </table>
              </form>
     <hr noshade>
   
</body>
</html>

二,Insert.php源碼:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>insert</title>
</head>

<body>
<?php
mysql_connect("ftp","root","");
mysql_select_db("test");
$sql="insert into score (Number,Name,Chinese,English,Math) values ($Number,'$Name',$Chinese,$English,$Math)";
mysql_query($sql);
?> 新增一筆資料成功,<a href="insert.htm">請反回</a>!
</body>
</html>

所用到的SQL語句:insert into score (Number,Name,Chinese,English,Math) values ($Number,'$Name',$Chinese,$English,$Math)

作者:(臺灣)王國榮

原文轉自:http://www.anti-gravitydesign.com

国产97人人超碰caoprom_尤物国产在线一区手机播放_精品国产一区二区三_色天使久久综合给合久久97