Login   Register  
PHP Classes
elePHPant
Icontem

File: getCities.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Pravin Sonawane  >  AJAX List Box  >  getCities.php  >  Download  
File: getCities.php
Role: Example script
Content type: text/plain
Description: Database Request File
Class: AJAX List Box
Retrieve MySQL query results into arrays
Author: By
Last change: Class Integration
Date: 4 years ago
Size: 447 bytes
 

Contents

Class file image Download
<?php
    
include("functions.php");        
    
$db = new PHP_fun();
    
$str "";
    
$stateid trim($_REQUEST['stateid']);
    if (
$stateid != "")
    {
        
$sql sprintf("SELECT city_id, city_name FROM city WHERE state_id = '%d' "$stateid);
        
$rs $db->select_row($sql);
        if (
count($rs) > 0)
        {
            for(
$i=0;$i<count($rs);$i++)
            {
                
$str .=  $rs[$i]['city_id'].":".$rs[$i]['city_name']."###";
            }
            echo 
$str substr($str,0,-3);
        }
    }
?>