Advanced 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

Pages: [1]   Go Down

Author Topic: MYSQL - XML issue  (Read 2721 times)

0 Members and 1 Guest are viewing this topic.

gothteen

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
MYSQL - XML issue
« on: June 27, 2008, 10:20:03 pm »

hi all,

first off all, i like to say that coppermine rocks!!!!!!!!!

Secondly, a quick question. I was working on a xml output for another part of my site (could be used on any other server if someone likes it), when i encounterd some errors.
The function has to be that when i call a album (dir) the flash script i use shows all images from that directory. Sounds easy, its not:(

Ok, first off all, the config.php:
Code: [Select]
<?php 
$host 
"***"
$user "***"
$pass "***"
$database "***";

$slink "http://***/";
$sname "//***//";
$backgroundColor "000000";
$imageWidth "1200";
$imageHeight "1200";
$imageSpaceX "1200";
$imageSpaceY "1200";
$imageBorderColor "a3a3a3";
$imageBorder "1";
$imageSmoothing "no";
$explanation "yes";
?>

The xml.php:
Code: [Select]
<?php 
include("config.php");
header("Content-type: text/xml"); 
 
$linkID mysql_connect($host$user$pass) or die("Could not connect to host."); 
mysql_select_db($database$linkID) or die("Could not find database."); 
$query "SELECT filename FROM cpg14x_pictures ORDER BY filename ASC"
$resultID mysql_query($query$linkID) or die("Data not found."); 

$xml_output "<?xml version=\"1.0\"?>
\n";
$xml_output = "<gallery>\n";
    $xml_output .= "\t<options>\n";
    $xml_output .= "\t<backgroundColor>$backgroundColor</backgroundColor>\n";
    $xml_output .= "\t<imageWidth>$imageWidth</imageWidth>\n";
    $xml_output .= "\t<imageHeight>$imageHeight</imageHeight>\n";
    $xml_output .= "\t<imageSpaceX>$imageSpaceX</imageSpaceX>\n";
    $xml_output .= "\t<imageSpaceY>$imageSpaceY</imageSpaceY>\n";
    $xml_output .= "\t<imageBorderColor>$imageBorderColor</imageBorderColor>\n";
    $xml_output .= "\t<imageBorder>$imageBorder</imageBorder>\n";
    $xml_output .= "\t<imageSmoothing>$imageSmoothing</imageSmoothing>\n";
    $xml_output .= "\t<explanation>$explanation</explanation>\n";
    $xml_output .= "\t<name>$sname: " . $_GET['dir'] . "</name>\n";   
    $xml_output .= "\t</options>\n";
    $xml_output .= "\t<pictures>\n";
    $xml_output .= "\t<album>\n";
for($x = 0 ; $x < mysql_num_rows($resultID) ; $x++){
    $row = mysql_fetch_assoc($resultID);
    $xml_output .= "\t<pic>\n";
    $xml_output .= "\t<bigimage>http://***/" . $_GET['dir'] . "/" . $row['filename'] . "</bigimage>\n";
    $xml_output .= "\t</pic>\n";
}
    $xml_output .= "\t</album>\n";
    $xml_output .= "\t</pictures>\n";
$xml_output .= "</gallery>";
echo $xml_output;
?>
(http://***/ is my site, i made it censored, if anyone likes to see it, please pm me)

The problem is not that it shows the files, but it doesnt show them from the right album, better yet, it doesnt see the albums at all:S...
It just picks the filename (first in line ASC), and goes to the next. How can i solve this problem?? Im working on it for days now, and still dont have it done:S...

aray to call the albums should look like this: http://***/?dir= album name.

For mods/admin: If i post this topic in the wrong thread, could you please move it for me?

For all other peoples: When this stuff works, itl be a great mod for other site's! So please help me, and i like to share this script (including some cool fancy flash works) with you.
Logged

Nibbler

  • Guest
Re: MYSQL - XML issue
« Reply #1 on: June 27, 2008, 10:37:06 pm »

You need to add a WHERE condition to the SQL query to filter by filepath.
Logged

gothteen

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: MYSQL - XML issue
« Reply #2 on: June 27, 2008, 10:57:21 pm »

yeah, thanks for the help, forgot that one :-[

Anyway, the script is done, and as promised, i uploaded the script for anyone!!!

You can all download it here:
Rapidshare

Please read the readme before installing the script. It contains some usefull help;)

If this topic is placed in the wrong section of the site, could on of the mods please move it for me??
« Last Edit: June 28, 2008, 03:54:29 am by Nibbler »
Logged
Pages: [1]   Go Up
 

Page created in 0.017 seconds with 20 queries.