Hya all,
I have now managed to do it!!
The reason why I wanted to switch to XML instead of Mysql is because I thought it was gonna be faster, but It seams that they take the same time to process.
If anyone is interested i used the following code:
---------------------------
<?php
// make drawArray[0] = 10,12,13....,W,19/12/2004
$all_draws_xml = array();
$drawArray = array();
function character_data($parser, $data) {
// make all_draws_xml array and populate with all the results
global $all_draws_xml;
if ($data == 'W' || $data == 'S')
{
$all_draws_xml[] = $data;
}
elseif ($data != 0)
{
$all_draws_xml[] = $data;
}
}
function make_draws_array(){
global $all_draws_xml;
global $drawArray;
global $temp;
$temp = 0;
$count = count($all_draws_xml);
$finalVar = ($count / 9);
$increment = 0;
for($i=0;$i<$finalVar;$i++){
for ($z = $increment ; $z < ($increment+9); $z++){
$drawArray[$i][] = $all_draws_xml[$z];
}
$increment += 9;
}
return $count;
}
$parser = xml_parser_create();
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false);
xml_set_character_data_handler($parser, 'character_data');
$document = file('drawsXml2.xml');
foreach ($document as $line) {
xml_parse($parser, $line);
}
make_draws_array();
?>
----------------
http://www.f34r.co.uk/dan/companion.php (MySql)
http://www.f34r.co.uk/dan/companionXML.php (XML)
-----------
Thx for everybodys help
peace out!