Hi
I’ve been trying to customise a script i found for an autocomplete search field using a php mysql query.
The php file is below, it’s searching mobile phone make and models, all works but when i search sam for Samsung i get nothing unless i search Sam
So my first question is can i change (with your help) the search code in the PHP to not be case sensitive?
also if i search Samsung D600 it finds the phone but i’d like it to find this phone if i just type D600, could this be a possibility with this code?
<?php
require “dbcommon.php”;
$result = mysql_query(“SELECT* FROM handsets”);
while ($row = mysql_fetch_assoc($result)) {
$handsets[] = $row[‘product_name/handset’];
}
mysql_free_result($result);
// check the parameter
if(isset($_GET[‘part’]) and $_GET[‘part’] != ‘’)
{
// initialize the results array
$results = array();
// search handsets
foreach($handsets as $handset)
{
// if it starts with 'part' add to results
if( strpos($handset, $_GET['part']) === 0 ){
$results[] = $handset;
}
}
// return the array as json with PHP 5.2
echo json_encode($results);
}
?>
thanks for any help given