I am trying to write an POLYGON into an column named SHAPE which is a geometry type. And created query which looks
$sql = "INSERT INTO rokka(zone, mineral, district,location,area,toposheet,Verification,SHAPE) VALUES ('$zone', '$mineral','$district','$location','$area','$toposheet','$v',PolygonFromText('$polywrite'))";
The variable $polywrite comes as
var polygon = 'Polygon((' + northeastlngLat[0] + ' ' + northeastlngLat[1] + ',' + northwestlngLat[0] + ' ' + northwestlngLat[1] + ',' + southwestlngLat[0] + ' ' + southwestlngLat[1] + ',' + southeastlngLat[0] + ' ' + southeastlngLat[1] + ',' + northeastlngLat[0] + ' ' + northeastlngLat[1] + '))';$polywrite = "";The arrays contain the coordinates.And when executing
if ($connect->query($sql) === TRUE) { session_start(); header('location: admin.html'); session_destroy();} else { echo "Error: " . $sql . "
" . $connect->error; }The error it shows is
Column 'SHAPE' cannot be nullError: INSERT INTO rokka(zone, district,location,area,SHAPE) VALUES ('Rapti', 'Rolpa','Liwang','603750', PolygonFromText('Polygon((85.06290725100276 28.00935569163021,85.06392404943365 28.0093478254886,85.06393735099435 28.01070145242192,85.06292053985693 28.010709319009717,85.06290725100276 28.00935569163021))'))Column 'SHAPE' cannot be nullBut whenever I run the query
INSERT INTO rokka(zone, district,location,area,SHAPE)VALUES ('Rapti', 'Rolpa','Liwang','603750', PolygonFromText('Polygon((85.06290725100276 28.00935569163021,85.06392404943365 28.0093478254886,85.06393735099435 28.01070145242192,85.06292053985693 28.010709319009717,85.06290725100276 28.00935569163021))'))in my database directly It works exactly as it should. All the values are written into the respective columns. Please help me figure out what i am doing wrong.
أكثر...
$sql = "INSERT INTO rokka(zone, mineral, district,location,area,toposheet,Verification,SHAPE) VALUES ('$zone', '$mineral','$district','$location','$area','$toposheet','$v',PolygonFromText('$polywrite'))";
The variable $polywrite comes as
var polygon = 'Polygon((' + northeastlngLat[0] + ' ' + northeastlngLat[1] + ',' + northwestlngLat[0] + ' ' + northwestlngLat[1] + ',' + southwestlngLat[0] + ' ' + southwestlngLat[1] + ',' + southeastlngLat[0] + ' ' + southeastlngLat[1] + ',' + northeastlngLat[0] + ' ' + northeastlngLat[1] + '))';$polywrite = "";The arrays contain the coordinates.And when executing
if ($connect->query($sql) === TRUE) { session_start(); header('location: admin.html'); session_destroy();} else { echo "Error: " . $sql . "
" . $connect->error; }The error it shows is
Column 'SHAPE' cannot be nullError: INSERT INTO rokka(zone, district,location,area,SHAPE) VALUES ('Rapti', 'Rolpa','Liwang','603750', PolygonFromText('Polygon((85.06290725100276 28.00935569163021,85.06392404943365 28.0093478254886,85.06393735099435 28.01070145242192,85.06292053985693 28.010709319009717,85.06290725100276 28.00935569163021))'))Column 'SHAPE' cannot be nullBut whenever I run the query
INSERT INTO rokka(zone, district,location,area,SHAPE)VALUES ('Rapti', 'Rolpa','Liwang','603750', PolygonFromText('Polygon((85.06290725100276 28.00935569163021,85.06392404943365 28.0093478254886,85.06393735099435 28.01070145242192,85.06292053985693 28.010709319009717,85.06290725100276 28.00935569163021))'))in my database directly It works exactly as it should. All the values are written into the respective columns. Please help me figure out what i am doing wrong.
أكثر...