Fetch some data from MySQL Fetch some data from MySQL
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Fetch some data from MySQL

Started by JohanX, May 07, 2006, 12:06:30 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

JohanX

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

Joachim Müller