in nodejs every time i try use
var geometry = 'GeomFromText(&rsquoPOLYGON('+Area1x+' '+Area1y+','+Area2x+' '+Area2y+','+Area3x+' '+Area3y+','+Area4x+' '+Area4y+','+Area1x+' '+Area1y+')&rsquo,0)';
// console.log(geometry);
var data = {
"error":1,
"Area":""
};
if(!!Areanome && !!Area1x){
var query = connection.query("INSERT INTO likeyouarea VALUES(null,?,?)",[Areanome,geometry],function(err, rows, fields){
the commando in the sql expose this by console.log(query.sql);
INSERT INTO area VALUES(null,'area2','GeomFromText(&rsquoPOLYGON(-30.02724579591031 -51.22842527925968,-30.027021410835776 -51.22754216194153,-30.027769165561978 -51.22727394104004,-30.02800603078958 -51.228153705596924,-30.02724579591031 -51.22842527925968)&rsquo,0)')
but the correct query is and it's working but in console of phpmyadmin
INSERT INTO area VALUES(null,'area2',GeomFromText('POLYGON((-30.02724579591031 -51.22842527925968,-30.027021410835776 -51.22754216194153,-30.027769165561978 -51.22727394104004,-30.02800603078958 -51.228153705596924,-30.02724579591031 -51.22842527925968))',0))
How can I use the correct way usingo geoFromText it's a command not a string
I already look this INSERT INTO fails with node-mysql but it's all according mysql