第一个get接口

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

 

posted @ 2014-04-16 16:02  needly  阅读(171)  评论(0编辑  收藏  举报