XML PHP

Discussion in 'XML' started by J Sharman, Nov 13, 2003.

  1. J Sharman

    J Sharman Guest

    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
     
    J Sharman, Nov 13, 2003
    #1
    1. Advertising

  2. On Thu, 13 Nov 2003 15:08:11 +0000, J Sharman wrote:
    >
    > 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
     
    Alexander Schatten, Nov 13, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ted Zeng
    Replies:
    4
    Views:
    569
    Tim Arnold
    Oct 3, 2006
  2. Ted Zeng
    Replies:
    0
    Views:
    684
    Ted Zeng
    Oct 13, 2006
  3. torque63
    Replies:
    0
    Views:
    665
    torque63
    Jan 1, 2009
  4. raviraj joshi
    Replies:
    0
    Views:
    359
    raviraj joshi
    Jul 4, 2009
  5. Rajive Narain
    Replies:
    0
    Views:
    2,083
    Rajive Narain
    Sep 18, 2009
Loading...

Share This Page