I am trying to use SimpleXML with PHP to get a value from XML stored in a database. A portion of my XML looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<java version="1.8.0_161" class="java.beans.XMLDecoder">
<object class="atavism.agis.objects.AgisMob" id="AgisMob0">
<void property="name">
<string>Rachels</string>
</void>
<void property="oid">
<object class="atavism.server.engine.OID" id="OID0">
<void property="data">
<long>41321</long>
</void>
I also have other XML in the same "document" that looks like this:
So that being said, I would probably need to fetch it where the property attribute is equal to "name". I do plan on getting other information from this document later on as well, just need to figure out how.
Here is the code I have so far:
$blob_query = mysqli_query($dbh8, "SELECT * FROM objstore WHERE obj_id='$characterId' AND type='PLAYER' AND namespace_int='3' ORDER BY obj_id DESC LIMIT 1");
if($blob_query){
$blob_row = mysqli_fetch_assoc($blob_query);
$data = $blob_row['data'];
$xml=simplexml_load_string($data) or die("Error: Cannot create object");
echo $xml->void[0]->string;
}
It is not displaying anything. It should be displaying "Rachels". Any help is very much appreciated!