Hi, I have been given an XML database to work with which i have never worked with before. What i need to do is convert the following php code to work with an XML database? <?php $search_text=trim($_POST['search_text']); $kt=split(" ",$search_text);//Breaking the string to array of words // Now let us generate the sql while(list($key,$val)=each($kt)){ if($val<>" " and strlen($val) > 0){$q .= " title like '%$val%' or ";} $q=substr($q,0,(strLen($q)-3)); // this will remove the last or from the string. $query="select * from news where $q "; $nt=mysql_query($query); $countrowssa = mysql_num_rows($nt); if ($countrowssa < 1){ echo "Sorry there are no results matching your search criteria, Please try again."; } echo mysql_error(); while($row=mysql_fetch_array($nt)){ print $row[title]; } // End if form submitted ?> Code (markup): Any ideas how i can get this to work with an XML database? Cheers, Adam
I think you're not describing clearly enough what you want to do. Also, an example of this XML database would be quite helpful.
Basically the top example of code searches a table called news in an SQL database. I want to use this same code but in place of searching a table in an SQL database i want to search a XML database called db.xml