Hi,
I want to fetch the last picture posted to coppermine and for that i made this code, but it doesn't seem to work.. I saw in coppermine code that it uses a special function to connect to mysql but the include and require functions are so many that i get lost searching for the right thing
The code that i made : <?php
// MySQL configuration
$dbserver ='******'; // Your database server
$dbuser = '******'; // Your mysql username
$dbpass = '******'; // Your mysql password
$dbname = '******';
$conex = mysql_pconnect($dbserver,$dbuser,$dbpass) or die('Can\'t connect !');
mysql_select_db($dbname,$connex);
$result = mysql_query("SELECT * FROM cpg145_pictures ORDER BY pid DESC LIMIT 1");
$row = mysql_fetch_array($result);
$w = $row['pwidth'];
$h = $row['pheight'];
$fixedw = 110;
$fixedh = 110;
if ($w>$h) {
if ($w>$fixedw) { $w = $w - $fixedw;
$am = ($w/$t)*100;
$h = $h - (round(($am*$h)/100));
}
} elseif ($h>$fixedh) { $h = $h - $fixedh;
$am = ($w/$t)*100;
$w = $w - (round(($am*$w)/100));
}
echo'
<strong>Last adition</strong> <br />
<img border="0" src="cm/'.$row['filepath'].$row['filname'].'" width="'.$w.'" height="'.$h.'" alt="'.$row['title'].'" title="'.$row['title'].'" /> <br/>
<p>'.$row['title'].'</p>';
?>
ignore the resizing part.. just the array fetching i'm interested in. it doesn't give a connection error but it doesn't show anything if I call mysql_query('Show tables');
Thanks,
Johan
http://forum.coppermine-gallery.net/index.php?board=57.0