mehenky
-
Posts
5 -
Joined
-
Last visited
Posts posted by mehenky
-
-
im following the basic steps in: http://uk3.php.net/manual/en/simplexml.examples-basic.php that is working good.
but now ive made this just to view:<?php $file = simplexml_load_file('stats.xml'); $check = new SimpleXMLElement($file); echo $check->counts[0]->total; ?>
but im getting this error:
Warning: SimpleXMLElement::__construct(): Entity: line 16: parser error : Start tag expected, '<' not found in C:\xampp\htdocs\simplexml.php on line 3
Warning: SimpleXMLElement::__construct(): in C:\xampp\htdocs\simplexml.php on line 3
Warning: SimpleXMLElement::__construct(): ^ in C:\xampp\htdocs\simplexml.php on line 3
Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in C:\xampp\htdocs\simplexml.php:3 Stack trace: #0 C:\xampp\htdocs\simplexml.php(3): SimpleXMLElement->__construct('\n \n \n \n \n ...') #1 {main} thrown in C:\xampp\htdocs\simplexml.php on line 3what is wrong with the code? below how the xml looks like.
<?xml version="1.0" encoding="UTF-8" standalone="true"?> <stats> <generated>140510</generated> <u id="2"> <user>meh</user> </u> <counts> <total>156715</total> <online> <now>125</now> <today>1111</today> <week>1576</week> </online> <registrations> <today>206</today> <week>505</week> </registrations> </counts> </stats>
-
thanks adam, i think this is what i need.
-
ah okay. yes i want to add the values to a db.
im new to php so im looking for the easiest.
i will have a look at it.
thanks for the quick reply.
-
Hello, i need some help/info about searching words in files (txt or xml) and saving them to db or another file.
For example ive got an xml file like below:
<families>
<family>
<name>brown</name>
<city>denver</city>
<members>12</members>
</family>
<family>
<name>jackson</name>
<city>new york</city>
<members>6</members>
</family>
</families>
i want to search for: <family> then save the lines till it comes to the word </family> and then goes to the next group. did some reading about array, preg_match, strpos functions but dont know where to start. what is the best way to do this?
can you guys give me some advise... or links to good tutorials?
thanks in advance!
-
Hello,
My name is Henk. im new to php so i tought lets sign up here
I was reading about array function got some questions about that but i will make another topic about it.
search words in .xml file and save to DB
in PHP Coding Help
Posted
Thanks. Gonna test it.