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: Fetch some data from MySQL  (Read 2257 times)

0 Members and 1 Guest are viewing this topic.

JohanX

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Fetch some data from MySQL
« on: May 07, 2006, 12:06:30 pm »

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 :
Code: [Select]
<?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
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Logged
Pages: [1]   Go Up
 

Page created in 0.048 seconds with 19 queries.