code for the livesearch.php is here
<?php
define('IN_COPPERMINE', true);
define('LOGIN_PHP', true);
require('include/init.inc.php');
$q=$_GET["q"];
if (strlen($q) > 0 )
{
$hint = "";
$searchword = explode(" ", $q);
for( $i = 0; $i < sizeof($searchword); $i++ ){
$searchword[$i] = "{$CONFIG['TABLE_PICTURES']}.title LIKE '%" .$searchword[$i]. "%'";
//echo $searchword[$i] . "\n";
}
$ready = implode(" AND ", $searchword);
//echo $ready;
$result = cpg_db_query("SELECT {$CONFIG['TABLE_ALBUMS']}.aid, {$CONFIG['TABLE_ALBUMS']}.title, COUNT({$CONFIG['TABLE_PICTURES']}.pid) FROM {$CONFIG['TABLE_ALBUMS']}, {$CONFIG['TABLE_PICTURES']} WHERE ({$CONFIG['TABLE_PICTURES']}.aid={$CONFIG['TABLE_ALBUMS']}.aid AND $ready) GROUP BY {$CONFIG['TABLE_PICTURES']}.aid ORDER BY {$CONFIG['TABLE_ALBUMS']}.title ASC");
while ($row = mysql_fetch_array($result)) {
if ( $hint == "" ){
$hint = '<div><div style="width:85%;float:left;"><a href="thumbnails.php?album='. $row[0].'">'. $row[1]. '</a></div><div style="width:10%;float:right;text-align:right">'.$row[2].' files</div></div>';
}
else{
$hint = $hint . '<div><div style="width:85%;float:left;"><a href="thumbnails.php?album='. $row[0].'">'. $row[1]. '</a></div><div style="width:10%;float:right;text-align:right">'.$row[2].' files</div></div>';
}
}
mysql_free_result($result);
}
// Set output to "no suggestion" if no hint were found
// or to the correct values
if ($hint == ""){
$response = "Try short one word name and then go from there";
}
else{
$response = $hint;
}
//output the response
echo $response;
?>