View Full Version : SELECT query and plot onto Google Maps

01-20-2012, 04:36 PM
I have some .js that allows me to connect to my sql database and plot all lat's and longs, yet the page I want it displayed is a results page from a form.

The query I currently have in the google api script is;

$query = mysql_query("SELECT * FROM `family_support` WHERE 1");
while ($row = mysql_fetch_array($query)){
echo ("addMarker($lat, $long,'<b>$org_name</b><br/>$org_address');\n");

i would like this to change (as it is displaying all rows currently) to the query I have in the results page;

$sql_result= "SELECT * FROM family_support WHERE org_name LIKE '%$org_name%'";

if ($area != 'All') {
$sql_result .=" AND area LIKE '%$area%'";
if ($services != 'All') {
$sql_result .=" AND services LIKE '%$services%'";
if ($hardiker != 'All') {
$sql_result .=" AND hardiker = '$hardiker'";

$sql_result .=" ORDER BY org_name";
//echo $sql_result;
$result = mysql_query($sql_result, $dbh) or die ('Database currently being updated, please try again later!');

Is this possible?

01-20-2012, 06:13 PM
I don't see why it wouldn't work.
You'll just have to know if you found any results (rows).

What are you getting for this?

If it's always 0, that means nothing is matching your query.

01-23-2012, 08:11 PM
What I'm trying to do is to change the query in the google maps script to match that of the second query. The query in the google maps script is showing all the results of my DB, not those from a form I made that is using the 2nd...

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum