|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 |
<?php$con = mysql_connect("127.0.0.1","root","123456");if (!$con){die(‘Could not connect: ‘
. mysql_error());}mysql_select_db("my_db", $con);// 插入数据$first
= $_GET["first"];$second
= $_GET["second"];$age = $_GET["age"];mysql_query("INSERT INTO Persons (FirstName, LastName, Age) VALUES ($first, $second, $age)");// 查询数据$result
= mysql_query("SELECT * FROM Persons");$row = mysql_fetch_array($result);print_r($row);mysql_close($con);?> |
原文:http://www.cnblogs.com/needly/p/3668854.html