Potter_gold
04-24-2007, 08:16 PM
Hi
I am struglling with a my first bit of mySql, that i am attempting to do on my own. I usually get some help from the web team at work.
Objective - I am trying to build pages on specific genre "example is Bart Simpson - http://www.freepspwallpapers.co.uk/the_simpsons/bart_simpson.php
What i want to do is only show my Bart Simpson Wallpapers on this page. I have started some of my coding, but wondered if you can help?
Peter
<?php
// Connect to the database.
require('dbconnect.php');
// Select what we want.
$sql = 'SELECT * TABLE 'wallpapers' WHERE `description` = 'wallpapername';
// Use the paged results class to easily create paged results.
$results_per_page = 12;
$pages = new MySQLPagedResultSet($sql, $results_per_page, $database_connection);
$content = $pages->getPageNav("cid=".$_GET['cid']).'<div style="clear: both;"> </div>';
// Show the matching images.
$i = '1';
while ($row = $pages->fetchArray()) {
$content .= '<div style="float: left; padding: 0.2em; text-align: center;">'.$row['wallpapername'].'<br/><a href="javascript:popUp(\'/popup.php?imgid='.$row[wallpaperid].'\');"><img src="'.$row['wallpaperimagesmall'].'" alt="Free '.$row['wallpapername'].' PSP Wallpapers" title="Free '.$row['wallpapername'].' PSP Wallpapers" border="0"></a></div>';
if ($i == '4' || $i == '8' || $i == '12') {
$content .= '<div style="clear: both;"> </div>';
}
$i++;
}
$content .= '<div style="clear: both;">'.$pages->getPageNav("cid=".$_GET['cid']).'</div>';
$template = str_replace('{CONTENT}',$content,$template);
echo $template;
?>
I am struglling with a my first bit of mySql, that i am attempting to do on my own. I usually get some help from the web team at work.
Objective - I am trying to build pages on specific genre "example is Bart Simpson - http://www.freepspwallpapers.co.uk/the_simpsons/bart_simpson.php
What i want to do is only show my Bart Simpson Wallpapers on this page. I have started some of my coding, but wondered if you can help?
Peter
<?php
// Connect to the database.
require('dbconnect.php');
// Select what we want.
$sql = 'SELECT * TABLE 'wallpapers' WHERE `description` = 'wallpapername';
// Use the paged results class to easily create paged results.
$results_per_page = 12;
$pages = new MySQLPagedResultSet($sql, $results_per_page, $database_connection);
$content = $pages->getPageNav("cid=".$_GET['cid']).'<div style="clear: both;"> </div>';
// Show the matching images.
$i = '1';
while ($row = $pages->fetchArray()) {
$content .= '<div style="float: left; padding: 0.2em; text-align: center;">'.$row['wallpapername'].'<br/><a href="javascript:popUp(\'/popup.php?imgid='.$row[wallpaperid].'\');"><img src="'.$row['wallpaperimagesmall'].'" alt="Free '.$row['wallpapername'].' PSP Wallpapers" title="Free '.$row['wallpapername'].' PSP Wallpapers" border="0"></a></div>';
if ($i == '4' || $i == '8' || $i == '12') {
$content .= '<div style="clear: both;"> </div>';
}
$i++;
}
$content .= '<div style="clear: both;">'.$pages->getPageNav("cid=".$_GET['cid']).'</div>';
$template = str_replace('{CONTENT}',$content,$template);
echo $template;
?>