well turns out all i needed to be told was to add the command empty..
anyway it seems its actually not a prob to do with my code but more the actual ids of attachments.. for some reason its querying everything except them ok...
so i,ll need to have a good look into how the attachments are working regarding postids etc as its not how i had initially thought
that or the sql is wrong.. but that seems to be ok as its taking the data on the basis of per forum id
anyways heres all the code
.. in case that helps lol
note its sloppy as ive been editing it like mad to get this id`s prob fixed
PHP Code:
<?php
error_reporting(7);
require("./global.php");
if ($attachcount = 1 ){}
//TEST SCRIPT CONFIGS ///
$galcat = "12"; //forum id you wish to view the attachments of
$slimit = "10"; // last x attachments to show
/////////////////////////
/* $galcats should be the gallerys ids set in the admin panel
these can be exploded with a , so that they may be set easily,
optional is if they are stored in anew mysql table and maybe
queried at the start then the code can work on the basis of
( for galleryid?=$galcat then do the query below for that id )
also to be added is a query / function to retrieve the thread id
of each attachemnt (will look at the attachemnt file for this) */
$galquery1 = mysql_query("SELECT *
FROM attachment
LEFT JOIN post USING(attachmentid)
LEFT JOIN thread USING(threadid)
WHERE thread.forumid = $galcat
ORDER by attachmentid desc
LIMIT $slimit");
while( $r = mysql_fetch_array($galquery1) )
{
$galentid=$r['attachmentid'];
$galtime=$r['dateline'];
$galentry=$r['filedata'];
$galentryname=$r['filename'];
$galuserid=$r['userid'];
$galentryvisible=$r['visible'];
if( empty($galentryname) )
{
$imgshowno = "No Image";
echo ("$imgshowno");
}
elseif ($galentryname)
{
$imgshow = "<img src = $bburl/attachment.php?postid=$galentid ><br>";
$imgshow.= "<a href = $bburl/attachment.php?postid=$galentid>Full Image</a><br><br>";
echo ("$imgshow");
}
echo "$galentid<br>" ;
echo "$galentryname<br>" ;
}
/*the code for skipping the table entry $filedata when its empty (!$filedata)
must also be enetered aswell as the code for exploding the file name via a .
so as to abtian the attachment and create the correct thumbnail as well */
?>