Jump to content
iniciante

[duvida simples]pequena tradução de mysql para php

Recommended Posts

iniciante

sou iniciante em php e queria fazer uma pequena conversao de mysql para php do seguinte select em mysql:

SELECT CONTAINS(GeomFromText('POLYGON((......))'),POINT(......));

em php eu tenho o seguinte:

$bd = new PDO("mysql:host=localhost;dbname=nomebd", "root", "");

$query = "SELECT CONTAINS(GeomFromText('POLYGON((.....))'),POINT(......))";
$result = $bd->query($query);
echo $result;

Podem dar uma pequena ajuda?


RC

Share this post


Link to post
Share on other sites
KTachyon

Tu não fazer conversão do SQL para PHP. Continuas a utilizar SQL dentro de PHP.

O teu problema é que a query SQL que estás a tentar fazer não é válida.


“There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.”

-- Tony Hoare

Share this post


Link to post
Share on other sites
cristiano09

Experimenta fazer primeiro a query no MySQL ou no PHPMyAdmin, se resultar e der o output que precisas, voilá.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.