欢迎光临
我们一直在努力

Php应用实例--新增资料录到MySQL资料表-PHP教程,PHP应用

建站超值云服务器,限时71元/月

一,insert.htm源码:

<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)

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » Php应用实例--新增资料录到MySQL资料表-PHP教程,PHP应用
分享到: 更多 (0)