Login   Register  
PHP Classes
elePHPant
Icontem

File: examples/demo_11.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of J.  >  HTML SQL  >  examples/demo_11.php  >  Download  
File: examples/demo_11.php
Role: Example script
Content type: text/plain
Description: Example 11 - Shows how to query a simple XML file
Class: HTML SQL
Parse and extract information from HTML using SQL
Author: By
Last change:
Date: 8 years ago
Size: 812 bytes
 

Contents

Class file image Download
<?php

    
/*
    ** htmlSQL - Example 11
    **
    ** Shows how to query a simple XML file
    */

    
include_once("../snoopy.class.php");
    include_once(
"../htmlsql.class.php");
    
    
$wsql = new htmlsql();
    
    
// connect to the demo XML file:
    
if (!$wsql->connect('file''demo_xml.xml')){
        print 
'Error while connecting: ' $wsql->error;
        exit;
    }

    
/* execute a query:
       
       This query returns the id, name and password of all active users
    */
    
if (!$wsql->query('SELECT id, name, password FROM user WHERE $status == "active"')){
        print 
"Query error: " $wsql->error
        exit;
    }

    
// fetch results as array
    
foreach($wsql->fetch_array() as $row){
    
        
print_r($row);
        
    }
    
?>