Team I have a problem generating XML from MySQL thru PHP
The XML I need to needs to have this structure
<markers>
<line width="4" html="CAR1" colour="#0000FF" label="CAR1" >
<point label="04:57PM" lat="32.75" lng="-117.27" html="CAR1" />
<point label="04:58PM" lat="32.72" lng="-117.33" html="CAR1" />
</line>
<line width="4" html="CAR2" colour="#0000FF" label="CAR2" >
<point label="04:53PM" lat="32.75" lng="-117.22" html="CAR2" />
<point label="04:54PM" lat="32.75" lng="-117.23" html="CAR2" />
<point label="04:55PM" lat="32.78" lng="-117.27" html="CAR2" />
</line>
<line width="4" html="IMSI3" colour="#0000FF" label="CAR3" >
<point label="04:53PM" lat="32.73" lng="-117.22" html="CAR3" />
<point label="04:54PM" lat="32.75" lng="-117.27" html="CAR3" />
<point label="04:55PM" lat="32.72" lng="-117.33" html="CAR3" />
<point label="04:56PM" lat="32.67" lng="-117.27" html="CAR3" />
<point label="04:57PM" lat="32.65" lng="-117.15" html="CAR3" />
<point label="04:58PM" lat="32.62" lng="-117.03" html="CAR3" />
</line>
</markers>
I´m really making myself a mesh
I´have used something like that
while ($row = @mysqli_fetch_assoc($result)){
// Add to XML document node
$node = $dom->createElement("markers");
$newnode = $parnode->appendChild($node);
$newnode->setAttribute("car",$row['car']);
$newnode->setAttribute("timestamp", $row['timestamp']);
$newnode->setAttribute("lat", $row['lat']);
$newnode->setAttribute("lng", $row['lng']);
$newnode->setAttribute("label", $row['label']);
}
while is running thru aall the database, how can I do an internal while every time LABEL changes ??? Please help !!
I´ve managed to get something like that
//while($row = @mysqli_fetch_assoc($resultactivos)) {
// $activos[$index] = $row;
// $index++;
}
//foreach($activos as $nombre){
// $node=$dom->createElement("makers");
// $newnode = $parnode->appendChild($node);
// $newnode->setAttribute("activo",$nombre);
// $query = "SELECT * from recorrido WHERE activo = '$nombre'";
// $result = mysqli_query($connection,$query);
// while ($row = @mysqli_fetch_assoc($result)){
// // Add to XML document node
// $newnode->setAttribute("tiempo", $row['timestamp']);
// $newnode->setAttribute("lat", $row['lat']);
// $newnode->setAttribute("lng", $row['lng']);
// $newnode->setAttribute("car", $row['car']);
//}
//}
But still faling miserably....