Exemplo n.º 1
0
if (isset($_GET["strSearch"])) {
    $opt = new OptionClass();
    $con = mysql_connect("localhost", "DORMA", "dorm");
    $strSearch = $_GET["strSearch"];
    $length = 200;
    if (!$con) {
        die('Could not connect: ' . mysql_error());
    }
    mysql_select_db("dormdatabase", $con);
    if (trim($strSearch) != "") {
        $strSearchArr = explode(" ", $strSearch);
        $fieldArr = $opt->returnFieldsArray();
        $mainQuery = $opt->returnStrQuery($fieldArr, $strSearchArr, "SELECT * FROM RESIDENT WHERE");
        //$mainQuery = mysql_query("SELECT FirstName, LastName from resident where LastName LIKE '$strSearch%'");;
        //$returnFName = mysql_query("SELECT FirstName, LastName from resident where FirstName LIKE '$strSearch%'");;
        $table = $opt->returnTable(mysql_query($mainQuery), 'FirstName', 'LastName', $length);
        //returnTD($returnFName,'FirstName','LastName');
        echo $table;
    } else {
        echo "";
    }
}
?>

<?php 
class OptionClass
{
    function returnTable($ret, $f1, $f2, $len)
    {
        //table for autcomplete
        $cnt = 0;