Change From Album To Pictures In Results From The AJAX Live Search Change From Album To Pictures In Results From The AJAX Live Search
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Change From Album To Pictures In Results From The AJAX Live Search

Started by will, May 19, 2007, 06:15:23 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

will

Hi

I'm currently using the Album List PHP and AJAX Live Search 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

will

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) > )
{
$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;

?>

will

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

will

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

Joachim Müller

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!". If your posting is fit for the paid support board, it will be moved there.

will

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

bowserbabe

I'll do it. If nobody else has volunteered, I'll send you a PM.

will


bowserbabe

Gah, sorry, forgot to have it send me e-mail notifications if anyone replied.

will

thank you for the PM but the coding you sent me still didn't change anything, still getting the error ???