Mixing 3 xml-files together showing maps

M

Martin Honnen

Tine said:
How can I mix this to one file showing all the markers on Sjælland

var xmlfile = [];
//Sjælland
xmlfile[1] = "map_data_xml.php?category=sh";
xmlfile[2] = "map_data_xml.php?category=sf";
xmlfile[3] = "map_data_xml.php?category=sb";


http://www.tinemuller.dk/alle_folkebiblioteker/dropdownmenu/PVII/

Well it looks like the easiest approach is to change that
map_data_xml.php code to allow you to fetch marker data for different
categories e.g. to allow
map_data_xml.php?category=sh&category=sf&category=sb
then you can simply pass that URL to your readMap function and it should
parse out the markers and display them.
 
T

Tine Müller

Well it looks like the easiest approach is to change that map_data_xml.php
code to allow you to fetch marker data for different categories e.g. to
allow
map_data_xml.php?category=sh&category=sf&category=sb
then you can simply pass that URL to your readMap function and it should
parse out the markers and display them.

Hej Martin

Thanks for trying to help but I'm not sure what to change in
map_data_xml.php? This it how it looks now:

//Get the variable from the link
$category=$_GET["category"];

// Select all the rows in the markers table
$query="SELECT * FROM manyboxes_alle_folkebiblioteker WHERE category
='$category' ORDER BY branchname ASC ";

And I have made this in index.php

theText[13] = "Sjælland - Alle";
xmlfile[13] = "map_data_xml.php?category=sh&category=sf&category=sb";

<a href="javascript:;"
onclick="handleSelected(13);changeText(13)">Evt. ALLE</a>

But when you click on the menu "Sjælland - Evt. ALLE" you see the markers
from "Bogbusser".

What code shall I change for it to work?

/Tine
 
M

Martin Honnen

Tine said:
"Martin Honnen" wrote
Thanks for trying to help but I'm not sure what to change in
map_data_xml.php? This it how it looks now:

//Get the variable from the link
$category=$_GET["category"];

My PHP is rusty and I have never been very good at it. I forgot that for
PHP you need to suffix your parameters with [] if you want to provide
several with the same name and want PHP to provide you an array. So you
need links alike
map_data_xml.php?category[]=sh&category[]=sf&category[]=sb
then you can process the data as follows I hope:
// Select all the rows in the markers table
$query="SELECT * FROM manyboxes_alle_folkebiblioteker WHERE category
='$category' ORDER BY branchname ASC ";

$inarg = "'" . implode("','", $_GET['category']) . "'";


// Select all the rows in the markers table
$query="SELECT * FROM manyboxes_alle_folkebiblioteker WHERE category
IN ($inarg) ORDER BY branchname ASC ";


Your original code and the change above are open to SQL injection
attackes, ask in a PHP group how to fix that.
 
T

Tine Müller

My PHP is rusty and I have never been very good at it. I forgot that for
PHP you need to suffix your parameters with [] if you want to provide
several with the same name and want PHP to provide you an array. So you
need links alike
map_data_xml.php?category[]=sh&category[]=sf&category[]=sb
then you can process the data as follows I hope:
// Select all the rows in the markers table
$query="SELECT * FROM manyboxes_alle_folkebiblioteker WHERE category
='$category' ORDER BY branchname ASC ";

$inarg = "'" . implode("','", $_GET['category']) . "'";


// Select all the rows in the markers table
$query="SELECT * FROM manyboxes_alle_folkebiblioteker WHERE category
IN ($inarg) ORDER BY branchname ASC ";


Your original code and the change above are open to SQL injection
attackes, ask in a PHP group how to fix that.



I have made your changes but it doesn't work. Do you have other suggestions?

<!-- xmlfile[13] =
"map_data_xml.php?category=sh&category=sf&category=sb"; -->
xmlfile[13] =
"map_data_xml.php?category[]=sh&category[]=sf&category[]=sb";

//Get the variable from the link
/*$category=$_GET["category"];*/
$inarg = "'" . implode("','", $_GET['category']) . "'";

// Select all the rows in the markers table
/*$query="SELECT * FROM manyboxes_alle_folkebiblioteker WHERE category
='$category' ORDER BY branchname ASC ";*/
$query="SELECT * FROM manyboxes_alle_folkebiblioteker WHERE category IN
($inarg) ORDER BY branchname ASC ";

/Tine
 
M

Martin Honnen

Tine said:
I have made your changes but it doesn't work. Do you have other suggestions?

As I haven't seen much of your server-side code I am more or less
guessing what your server-side code might do and how it can be changed
to produce marker data for several categories.
When you say "it doesn't work" what does that mean exactly? Do you get
errors, if so which exactly?
 
T

Tine Müller

As I haven't seen much of your server-side code I am more or less guessing
what your server-side code might do and how it can be changed to produce
marker data for several categories.
When you say "it doesn't work" what does that mean exactly? Do you get
errors, if so which exactly?

I'm not sure what happend the first time but after deleting the new code and
afterwards today after your message pasted it again it looks like it's
functioning.:)

Now I will make it also for the other parts of the country.

Thanks so much for your help.

/Tine
 
T

Tine Müller

I was too quick to say it's functioning. Now it's only ALLE there is
functioning and not all the others.

I get this message when loading this
http://www.tinemuller.dk/alle_folkebiblioteker/dropdownmenu/PVII/map_data_xml.php?category=sh

Warning: implode() [function.implode]: Invalid arguments passed in
/home/www/tinemuller.dk/alle_folkebiblioteker/dropdownmenu/PVII/map_data_xml.php
on line 11

Warning: Cannot modify header information - headers already sent by (output
started at
/home/www/tinemuller.dk/alle_folkebiblioteker/dropdownmenu/PVII/map_data_xml.php:11)
in
/home/www/tinemuller.dk/alle_folkebiblioteker/dropdownmenu/PVII/map_data_xml.php
on line 25

Hope it's ok that I send you my map_data_xml.php to your private
mailaddress?

/Tine
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top