代码如下:
<?PHP
include('class\ymap.php');
$ymap = new ymap();
$ymap->point = $_POST['point'];
$ymap->name = $_POST['name'];
//echo("用户名:" . $ymap->point . "  密码:" . $ymap->name);
if($ymap->exists($ymap->name)) {
$ymap -> updatePoint();
}
else
{
$ymap->insert();
?>
        <script language="javascript">
 alert("成功保存");
 window.close();
</script>
        <?php
exit("");
}
?>ymap.php代码如下:
<?PHP
class ymap
{
var $conn;
public $point; // 用户标志点
public $name; // 显示名称


function __construct() {
// 连接数据库
$this->conn = mysqli_connect("localhost", "root", "110120", "exercitation"); 
mysqli_query($this->conn, "SET NAMES gbk");
}

function __destruct() {
// 关闭连接
mysqli_close($this->conn);
} // 判断用户的标志是否存在
function exists($user)
{
$result = $this->conn->query("SELECT * FROM y_map WHERE name='" . $user . "'");
if($row = $result->fetch_row()) {
$this->point = $point;
$this->name = $row[1];
return true;
}
else
return false;
}

//查询所有标志
function search()
{
$sql = "select * from y_map"; 
$this -> conn -> query($sql);
if($row != null){
$this -> point = $point;
$this -> name = $row[1];
}
}

// 插入新记录
function insert()
{
$sql = "INSERT INTO `y_map` (`point`, `title`) VALUES ('" . $this->name . "', '" . $this->point . "')";
$this->conn->query($sql);
}
//"INSERT INTO `y_map` (`point`, `title`) VALUES ('116.411776,39.942833', '如家快捷酒店');"


// 更新用户标志点
function updatePoint() {
$sql = "UPDATE y_map SET point='" . $this->point . "' WHERE name='" . $this->name . "'";
$this->conn->query($sql);
}
}
?>
都已经测试SQL语句没错,而且也测试POST进来的变量也有,就是为什么在SQL上没反应呢?sqlPHP