Answer the question
In order to leave comments, you need to log in
How to succinctly specify a variable as an iterator in SimpleXML (without xPath and DOM)?
XML file:
<?xml version="1.0" encoding="utf-8"?>
<top>
...
<block>
<id>0</id>
<n>Procyon1</n>
<f>f</f>
<t>d</t>
<r>r</r>
<l>112</l>
<q>u</q>
<e>?</e>
<b>?</b>
<p>?</p>
<s>?</s>
<c>?</c>
<sp>1</sp>
<bm>4</bm>
</block>
...
</top>
...script.php?id=2&n=Procyon1&f=f&t=d&r=r&l=314&q=u&e=%3F&b=%3F&p=%3F&s=%3F&c=%3F&sp=1&bm=4...
$sdb = simplexml_load_file('db.xml');
$i=$_GET['id'];
foreach($sdb->block as $block){
if ($i==$block->id){
foreach ($_GET as $key=>$value)
{
$block->{$key}=$value;
};
}
};
$sdb->asXml('db.xml');
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question