Jump to content

Auto Suggest box


roeyhaim

Recommended Posts

Hello

 

can anyone tell me why this function don't return anything ?

 

<?php include_once('./header.php'); ?>

<?php
    $var = Array();
    $data = $db->get("omnot", "fullname");
    
    foreach($data as $var){
        $var = $data;        
    }
    $input = strtolower( $_GET['input'] );   // the input is ok
    $len = strlen($input);
    
    
    $aResults = array();
    
    if ($len)
    {
        for ($i=0;$i<2;$i++)
        {
            if (strtolower(substr(utf8_decode($var),0,$len)) == $input)
                $aResults[] = array( "id"=>($i+1) ,"value"=>htmlspecialchars($var[$i]));
        }
    }

 

from the database i get the values: "roey" , "rrr" , "try"

input == r

 

why the function don't go to the line: 

$aResults[] = array( "id"=>($i+1) ,"value"=>htmlspecialchars($var[$i]));

 

whats wrong with the IF ?

Link to comment
https://forums.phpfreaks.com/topic/218571-auto-suggest-box/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.