Hi
I'm currently using the Album List PHP and AJAX Live Search (http://forum.coppermine-gallery.net/index.php?topic=42180.0) but the search results only bring up the album that the pictures are stored in, is there a way of showing the pictures instead
Thanks ;D
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;
?>
Right I've played around with the code to show the titles and I've got them to show, but when I click on the link to the file it gives me an error:
album/file does not exist
heres the code
<?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] = "title LIKE '%" .$searchword[$i]. "%'";
//echo $searchword[$i] . "\n";
}
$ready = implode(" AND ", $searchword);
//echo $ready;
$result = cpg_db_query("SELECT pid, title FROM {$CONFIG['TABLE_PICTURES']} WHERE $ready");
while ($row = mysql_fetch_array($result)) {
if ( $hint == "" ){
$hint = '<a href="thumbnails.php?album='. $row['pid'] .'">'. $row['title'] . '</a>';
}
else{
$hint = $hint . '<br /><a href="thumbnails.php?album='. $row['pid'] .'">'. $row['title'] . '</a>';
}
}
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;
?>
Can someone tell me where I'm going wrong
Thanks ;D
anybody, I have a test gallery to show the problem I'm having
http://cdcoverhideout.com/x
If nobody can help after taking a look can a mod move this to the Paid Support forum
Thanks
Post your budget and all the other data that is suppossed to be posted along with paid support requests as suggested in "sub-board rules, read first! (http://forum.coppermine-gallery.net/index.php?topic=8170.0)". If your posting is fit for the paid support board, it will be moved there.
Ok, If someone is willing to help me on this, I willing to pay $20.
The time schedule will be 1-2 weeks please has this will be a great mod to my site and I need it up and running within this time schedule.
A link is available further up this thread. Plus the code and the problem is too, if you need anymore details please ask here and I will post as much details has I can.
Thanks ;D
I'll do it. If nobody else has volunteered, I'll send you a PM.
thank you, I look forward to your pm ;D
Gah, sorry, forgot to have it send me e-mail notifications if anyone replied.
thank you for the PM but the coding you sent me still didn't change anything, still getting the error ???