Hi guys, I’m new to the forum & I’m returning to PHP for the first time in several years; so I feel as if I’m a beginner again that will get back into the swing of things quickly. However, I have a question
I have the following
[code]<? php
#Convert the String Into XML
$xml = new SimpleXMLElement($_POST[‘name’]);
#Itterate through the XML for the data
foreach($xml->vote as $vote)
{
$foo .= $vote->teamID;
}
?>[/code]
And that does work it gets me all the values, I can send that string to a DB or even view it in the browser; whatever I need to do…
However, the XML actually consists of 25 elements
So I’m trying to do something like this
[code]$query = “INSERT INTO table VALUES(”;
foreach($xml->vote as $vote)
{
$query .= $vote->teamID;
$query .= “,”;
}
$query = substr($query , 0 , -1);
$query .= “);”;
mysqli->query($query);[/code]
But for some reason this just doesn’t work; obviously I’m assuming
it’s a syntax issue and I’m just an idiot; but some help would be
amazing
Thanks for the potential help…