I have to deal with a table like this one with approximately a couple of hundreds of #id (and counting).
id field_name field_value
1 name pasta
1 lat 41.27651
1 long 11.45234
2 name pizza
2 lat 43.53455
2 long 12.62346
.. .... ........
.. .... ........
.. .... ........
I need to build an XML file that allows me to add markers on Google Map with a structure like this:
<makers>
<marker name="$name" lat="$lat" long="$long" />
<marker name="$name" lat="$lat" long="$long" />
(...)
</markers>
I am trying to do a query like this and then put all the info in arrays and play with some foreach but I am failing so hard that I can't go on.
$query = " SELECT field_val
FROM table
WHERE field_name='Name'";
The main problem is that i am not able to work with a structure like this, given the fact that a probably better structure would have been like this
id name lat long
1 pasta 41.27651 11.45234
2 pizza 43.53455 12.62346
.. ... ... ...
Please note that i can't change the way the entries go in the DB and that the structure of the table is more complicated than the one showed here (with approx. 15 field_name per id, not all of them necessary).
Sorry for the poor english and thanks for your time.