<?php $servername = "localhost";$username = "root";$password = "";$db = "users";$mysqli = new mysqli($servername, $username, $password, $db);// SET @g = 'POLYGON($_POST[coords])';$coords = $_POST['coords'];//$stmt = "INSERT INTO polygon_data (polygon_values) VALUES (PolygonFromText('POLYGON((30 10, 40 40, 20 40, 10 20, 30 10))'))";$stmt = "INSERT INTO polygon_data (polygon_values) VALUES (PolygonFromText('$coords'))";if ($mysqli->query($stmt) === TRUE) { echo "feedback sucessfully submitted";} else { echo "Error: " . $stmt . "<br>" . $mysqli->error;}$mysqli->close();?>當(dāng)我插入靜態(tài)值(如注釋行)時(shí),成功存儲(chǔ)在MySql中的數(shù)據(jù)以及我在mysql中的屬性是Polygon DataType。pollygon_values
1 回答

藍(lán)山帝景
TA貢獻(xiàn)1843條經(jīng)驗(yàn) 獲得超7個(gè)贊
代碼很好,但我們需要注意的是,第一件事是您在MySQL上選擇的數(shù)據(jù)類(lèi)型是Geometry或Polygon,第二件事是您應(yīng)該檢查從Google地圖獲得的多邊形坐標(biāo)值是否準(zhǔn)確意味著它們的緯度和經(jīng)度值是正確的并且也存在,這是我的問(wèn)題, 我沒(méi)有得到在谷歌地圖上繪制的多邊形的正確坐標(biāo)。
- 1 回答
- 0 關(guān)注
- 107 瀏覽
添加回答
舉報(bào)
0/150
提交
取消