On Mar 14, 1:43 pm, park2 <[email protected]> wrote:
> I have used the sample phpsqlajax_map.html in the samples. I an trying
> to pass a variable (tablename) to phpsqlajax_genxml.php.
>
> In phpsqlajax_genxml.php I have added $table = $_COOKIE["table"]; and
> changed the sql to:
>
> $query = 'SELECT * FROM '.$table; if I run phpsqlajax_genxml.php in a
> browser I get the xml output as expected.

If the cookie isn't working, how are you getting the right output?

> I have change phpsqlajax_map.html to phpsqlajax_map.php and added
> <?php  $table=$_GET['table']; $expire=time()+60*60*24*30; setcookie
> ("table", $table,$expire);?>

Is this line before any output from the php? Cookies have to be sent
as a header, so you can't do this after some text has been sent
(including a blank line perhaps) although I would have thought that it
would generate a "Headers already sent" or similar error.

> I call phpsqlajax_map.php?table=tablename from my main app.
>
> So I get tablename set it as a cookie, then I would expect
> phpsqlajax_genxml.php to generate populate the map but I do not get
> any markers showing. Any ideas on why this is not working or another
> approach I can use.

Have you checked using Firebug or something similar that the cookie is
being sent correctly?

An alternative: You could pass a tablename (or a value which is
interpreted to create the tablename) as a parameter in the genxml.php
URL: genxml.php?q=towns. Your genxml.php would receive q and construct
the table name from its value.

I would suggest not passing a literal table name between the client
and server anyway, whether you do it with a cookie or not. Cookies can
be inspected and the less you give away about your database the
better. Passing some sort of alias is preferred if you need to do it
at all.

[This isn't really a Maps API question; it's more of a PHP question]

Andrew
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to