Caute
,
mam problemik s PHP kodom.... mam xml subor :
Kód:
<parameters>
<parameter id="6" name="mesto" typ="ENUM" systemid="">
<enumValue valueId="5" value="Kosice"/>
<enumValue valueId="6" value="Bratislava"/>
<enumValue valueId="7" value="Presov"/>
<enumValue valueId="8" value="Martin"/>
<enumValue valueId="9" value="Levoca"/>
</parameter>
<parameter id="9" name="ulica" typ="ENUM" systemid="s9">
<enumValue valueId="4" value="hlavna"/>
<enumValue valueId="5" value="jarna"/>
<enumValue valueId="6" value="jesenna"/>
</parameter>
</parameters>
z neho sa mi podarilo vytiahnut
Kód:
insert into option values ( 6 , 'select' ,1 );
insert into option_description values ( 6 , 1 ,'mesto' );
insert into option values ( 9 , 'select' ,1 );
a insert into option_description values ( 6 , 1 ,'ulica' );
pomocou:
Kód:
foreach($xml->parameters->parameter as $key) {
echo "\n\r<br/><br/>insert into option values (
".$key['id']."
, 'select'
,1
);";
echo "\n\r<br/>insert into option_description values (
".$key['id']."
, 1
,'".$key['name']."'
);";
}
akonahle ale chcem vytiahnut enumValue pomocou 2x foreach, tak to nefunguje...
Kód:
foreach($xml->parameters->parameter as $key) {
echo "\n\r<br/><br/>insert into option values (
".$key['id']."
, 'select'
,1
);";
echo "\n\r<br/>insert into option_description values (
".$key['id']."
, 1
,'".$key['name']."'
);";
foreach($key->enumValue as $cat) {
echo "\n\r<br/>insert into option_value values (
".$cat['valueId']."
, 1
,'".$cat['value']."'
);";
}
}
vidi niekto chybu aku robim? alebo vie niekto poradit ako sa k tym datam dostat???
Vdaka za kazdu odpoved