roeyhaim Posted November 13, 2010 Share Posted November 13, 2010 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 More sharing options...
BlueSkyIS Posted November 13, 2010 Share Posted November 13, 2010 is this ever true? if (strtolower(substr(utf8_decode($var),0,$len)) == $input) echo strtolower(substr(utf8_decode($var),0,$len)) and echo $input and see what they are Link to comment https://forums.phpfreaks.com/topic/218571-auto-suggest-box/#findComment-1133794 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.