Location: PHPKode > projects > QuickTicket > quickticket/qti_j_name.php
<?php

// QuickTicket 2.5 build:20101222

if (!isset($_GET['q']) ) return;
if (empty($_GET['q']) ) return;

$strRole = ''; if ( isset($_GET['r']) ) $strRole = strtoupper($_GET['r']);
if ( $strRole=='A' ) $strRole = 'role="A" AND ';
if ( $strRole=='M' ) $strRole = '(role="A" OR role="M") AND ';

$arrValue = array();

include('bin/qt_lib_db.php');
include('bin/config.php');

// query

$oDBAJAX = new cDB($qti_dbsystem,$qti_host,$qti_database,$qti_user,$qti_pwd,$qti_port,$qti_dsn);
if ( !empty($oDBAJAX->error) ) return;

switch ($oDBAJAX->type)
{
case 'access': $oDBAJAX->Query('SELECT name FROM '.$qti_prefix.'qtiuser WHERE '.$strRole.' UCASE(name) like "%'.addslashes(strtoupper($_GET['q'])).'%"');
default:       $oDBAJAX->Query('SELECT name FROM '.$qti_prefix.'qtiuser WHERE '.$strRole.' UPPER(name) like "%'.addslashes(strtoupper($_GET['q'])).'%"');
}

$i=0;
while($row=$oDBAJAX->GetRow())
{
  if ( !in_array($row['name'],$arrValue) )
  {
    $arrValue[$i]=$row['name'];
    $i++;    
  }
  if ( $i>9 ) break;
}
if ( count($arrValue)==0 ) return;

foreach($arrValue as $strKey=>$strValue)
{
  echo "$strValue\n";
}

?>
Return current item: QuickTicket