I have a simple query i have and have verified the query works from pgadmin, I need it to work with a php based webpage
SELECT homes.phonenumber, homes.the_geom
FROM homes
WHERE
within( homes.the_geom,
(SELECT the_geom
FROM tornadowarnings
)
)
AND
the_geom &&
(SELECT homes.the_geom
FROM tornadowarnings
)
I am trying to get it to work with php using this :
<html>
<body>
<table border="0" cellspacing="0" cellpadding="0">
<?php
$db = pg_connect('host=localhost dbname=wxsvr user=postgres password=');
$query = "SELECT homes.phonenumber, homes.the_geom
FROM homes
WHERE
within( homes.the_geom,
(SELECT the_geom
FROM tornadowarnings
)
)
AND
the_geom &&
(SELECT homes.the_geom
FROM tornadowarnings
)"
$result = pg_query($query);
if (!$result) {
echo "Problem with query " . $query . "<br/>";
echo pg_last_error();
exit();
}
while($myrow = pg_fetch_assoc($result)) {
printf ("<tr>", $myrow['homes.phonenumber']));
}
?>
</table>
</body>
</html>