I say ‘basic’ because I’m sure this is a simple issue, but I’m just not quite sure where I’m going wrong.
Anyway, I’m trying to take data out of a feed that is formatted like this:
<progressive_jackpots casino="name">
<jackpot>
<game>Data</game>
<amount>Data</amount>
</jackpot>
<jackpot>
<game>Data</game>
<amount>Data</amount>
</jackpot>
</progressive_jackpots>
Here’s the PHP code I’m using:
$game = $progressive_jackpots->jackpot->game;
$amount = $progressive_jackpots->jackpot->amount;
However, I don’t seem to be populating either the $game or the $amount variables.
Can someone point out where I’m going wrong please?
Thanks a lot
What is this: $progressive_jackpots ? An object?
A little bit more code might be helpful.
Hi Guido - thanks for the reply.
Here’s the extended piece of the PHP code:
//find parent node for each product
case 'progressive_jackpots';
//initialise xml parser
$dom = new DOMDocument();
$domNode = $xmlReader->expand();
$element = $dom->appendChild($domNode);
$domString = utf8_encode($dom->saveXML($element));
$product = new SimpleXMLElement($domString);
//import data
$game = $progressive_jackpots->jackpot->game;
$amount = $progressive_jackpots->jackpot->amount;
//insert query into database
if ($query = mysql_query("REPLACE INTO progressives
(casino, game, amount)
VALUES ('Go Casino', '$game', '$amount')"))
{
}
else
{
echo "Problem with <strong>".$name."</strong>: ". mysql_error()."<br />";
}
}
}