I am using XML based database to save the records of large scale data in my web application. I know how to fetch all the data or specific data through XML tags in PHP. But I have no idea how I can update the data stored in XML tags using PHP. For instance I want to update the following XML tag by using XQuery from PHP.
<program id="p00547jm">
<time>
<startTime>1003394820</startTime>
<endTime>1003394826</endTime>
<epochStart>2001-10-18T08:47:00</epochStart>
<epochEnd>2001-10-25T08:47:00</epochEnd>
</time>
<completeTitle>in_our_time:_democracy</completeTitle>
<mediaType>audio</mediaType>
I am using following XQuery to update the value of 1 particular XML tag:
$query='for $x in doc("coursework")/bbcPrograms/program
where $x/completeTitle="'.$single_edit_program_title_hidden.'"
and $x/mediaType="'.$single_edit_program_type_hidden.'" and
$x/masterBrand="'.$single_edit_masterbrand_hidden.'" and
$x/service="'.$single_edit_service_hidden.'"
return update value $x/completeTitle[.="'.$single_edit_program_title_hidden.'"] with "'.$single_edit_program_title.'"';
It works correctly when we want to update 1 particular XML tag value. Now I want to make this XQuery work for updating tags values of multiple XML tags. Just as we do normally in SQL. SET id='abc' AND name = 'xyz'...
Please help me how this Xquery can work for multiple tags values update.