PHP Classes

AJAX List Box: Retrieve MySQL query results into arrays

Recommend this page to a friend!
  Info   View files Example   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 626 All time: 5,045 This week: 135Up
Version License PHP version Categories
ajax-list-box 1.0Freeware3.0Databases


This is a simple class that can be used to retrieve MySQL query results into arrays.

It can execute a given MySQL SELECT query and retrieves the results into an array.

Picture of Pravin Sonawane
  Performance   Level  
Name: Pravin Sonawane <contact>
Classes: 4 packages by
Country: India India
Age: 44
All time rank: 50828 in India India
Week rank: 398 Up34 in India India Down


$db = new PHP_fun();
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="javascript" type="text/javascript" src="validation.js"></script>
<script language="javascript" type="text/javascript">
    function getCities(id)
        var obj = document.form1;
        if (id != "")
            url = "getCities.php?stateid="+id;
  "GET", url, true);
            http.onreadystatechange = getCitiesResponse;
    function getCitiesResponse()
        var obj = document.form1;
        if (http.readyState == 4)
            var result = trimString(http.responseText);
            if (result != '' && result != 'undefined')
      [0] = new Option("-City-", "");
                var result_line_arr = result.split("###");
                for (i=0;i<result_line_arr.length;i++)
                    var result_arr = result_line_arr[i].split(":");
                    var code = result_arr[0];
                    var name = result_arr[1];
          [i+1] = new Option(name, code);
<table width="60%" border="0" cellspacing="0" cellpadding="5">
<form action="" method="post" name="form1">
      <td align="right" class="verdana11">State :</td>
      <td align="left" class="verdana11">
          <select name="state" id="state" onchange="javascript: getCities(this.value);">
            <option value="">-State-</option>
= "select * from state";
$rs = $db->select_row($sql);
<option value="<?=$rs[$i]['state_id']?>"><?=$rs[$i]['state_name']?></option>
                <?php }
      <td align="right" class="verdana11">City : </td>
      <td align="left" class="verdana11">
          <select name="city" id="city" style="width:150px;">
                <option value="">-City-</option>

  Files folder image Files  
File Role Description
Accessible without login Plain text file db.sql Data MySql Database File
Plain text file functions.php Class Class
Accessible without login Plain text file getCities.php Example Database Request File
Accessible without login Plain text file index.php Example Main File
Accessible without login Plain text file validation.js Data Javascript File

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:5,045
This week:135Up
User Comments (1)
very amazing script
11 years ago (arunachalam)