XML PHP

J

J Sharman

I am fairly familiar with PHP and MYSQL and I know a little about XML.

I would like to know if it is possible to do queries on XML similar to the
way that you do queries on MYSQL and then use the results.

An example of a simple PHP/MYSQL setup.

<?php
$user="username";
$host="sqlserver";
$password="password";
$database="database";
$connection = mysql_connect($host,$user,$password)
or die ("Couldn't connect to the server");
$db = mysql_select_db($database,$connection)
or die ("Couldn't connect to the server");

$query = "SELECT * FROM database WHERE(Criteria)";
$result = mysql_query($query)
or die ("Couldn't execute query.");

while ($row = mysql_fetch_array($result))
{
extract($row);
echo"Set of instructions to carry out for each row in the
result";
}

?>



The question is, is it possible to do similar things with PHP/XML?
Lets say that I have an XML file located at a certain URL and I want to run
a query on it and use the results.
1. Is it possible?
2. What is the easiest way to do it?
3. How would I translate the above code to work with XML?
4. Is ther resource on the web on how to structure the queries?


Any help is much appreciated.

Rgds

Joe
 
A

Alexander Schatten

The question is, is it possible to do similar things with PHP/XML? Lets
say that I have an XML file located at a certain URL and I want to run a
query on it and use the results.
1. Is it possible?
2. What is the easiest way to do it?
3. How would I translate the above code to work with XML? 4. Is ther
resource on the web on how to structure the queries?

I think you really should build a house by starting with the
foundation, not with the roof: I suggest, that you buy one of the dozens
of XML books, to get a better idea about XML.

then I suggest, that you look at standards like:

XSLT
XPATH
XQUERY
XML:DB (e.g., Apache Xindice, eXist)


Alex
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top