Advertisement

07.01.2008 at 02:03AM PDT, ID: 23529439
[x]
Attachment Details

How to use server-side (php) sql query with a client-side (javascript) variable?

Asked by Daniish in JavaScript, Web Languages/Standards, PHP Scripting Language

Tags: Javascript, PHP, Firefox 2.0, www.globexposure.net/index4.php

Hi,

My site is based on a Google Maps mashup and i currently use the following to display information related to my regional markers:
var html ='<div id="infowindow"><div id="infodescr"><h1>' + title + '</h1>' + description + '</div><div id="regional_poi">This is where i need a php script to display the result of its sql query for poi in this region</div><div id="infofooter"></div></div>';

What i'm trying to do is, display the title of all records from the 'locations' table of my database, where reg_id = the id of the current regional marker.

I started to write this sql query in php as follows:
$query_regions_poi = mysql_query("SELECT * FROM locations WHERE reg_id = regions['id']");
while ($row=mysql_fetch_assoc($query_regions_poi)){
  echo '<poi_in_region poi_id="'.$row['id'].'" title="'.parseToXML($row['title']).'" date="'.$row['date'].'"/>';
  }

... but i'm not sure about 2 things:
1. the WHERE clause - how can i pass it the 'id' of the current (regional) marker?
2. how do i display the results of this query in the place of the above text ("This is where i need a php script to display the result of its sql query for poi in this region")?

Many thanks for any adviceStart Free Trial
[+][-]07.01.2008 at 02:08AM PDT, ID: 21905967

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: JavaScript, Web Languages/Standards, PHP Scripting Language
Tags: Javascript, PHP, Firefox 2.0, www.globexposure.net/index4.php
Sign Up Now!
Solution Provided By: bevhost
Participating Experts: 1
Solution Grade: C
 
 
[+][-]07.01.2008 at 03:03AM PDT, ID: 21906169

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.01.2008 at 03:11AM PDT, ID: 21906196

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.01.2008 at 03:34AM PDT, ID: 21906277

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628