Hello everyone. I’m very very new to php. I’ve spent the last couple of days attempting to create an image gallery for my portfolio website, but I’ve ran in to a brick wall. Currently, these are the fields that I have in my table:
id
photo_name
date_added
description
title
project_type
date
media
objective
process
Here’s a link if you wish to see what it looks like right now: james-blanton.com/photo.php
For the time being I am using $sql = “SELECT * FROM photos ORDER BY id ASC LIMIT 0,1”; to display only one entry in the table [id 1]. What I want to do is create a link that will increment $id_position_y and $id_position_x when clicked.
Ultimately, I want to have a link that will load the next entry / ID in the table. AKA I want links that will proceed to the next image in my gallery or return to the previous image.
[code]<?PHP include "header.php"; ?>
<?PHP include "photo_gall_top.php"; ?><div style="position:relative; width:100%; text-align:left;">
<article id="description">
<nav id="project-nav">
<ul class="button-set">
<li><a class="button prev" href="#">prev</a></li>
<li id="section-title"><a>portfolio</a></li>
<li><a class="button next" href="#">next</a></li>
</ul>
</nav>
<?php
$dbhost = "#";
$dbuser = "#";
$dbpass = "#";
$dbname = "#";
$id = 1;
$id_position_y=0;
$id_position_x=1;
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ("Error connecting to database");
mysql_select_db($dbname) or die ("Error selecting the database");
function cleanString($caption="")
{
$removeunderscore = str_replace("_"," ",$caption);
$removedash = str_replace("-"," ",$removeunderscore);
$removedimensions = str_replace("1366x768","",$removedash);
$cleanstring = str_replace(".jpg","",$removedimensions);
return $cleanstring;
}
$display_id;
$sql = "SELECT
* FROM photos ORDER BY id ASC LIMIT $id_position_y,$id_position_x
";
$query = mysql_query($sql);
while($row = mysql_fetch_array($query))
{
$file = $row['photo_name'];
echo'<hgroup>
<h1 class="entry-title"><a href="#">'.$row['title'].'</a></h1>
<h2>'.$row['project_type'].'<time datetime="2010-03-05" pubdate="">'.$row['date'].'</time> </h2>
</hgroup>
<h3 class="type">
<div id="gallery_descrip" style="position:relative; text-align:left;">
<p>'.$row['description'].'</p>
</div>
</h3>
<ul class="delivery-list">
'.$row['media'].'
</ul>
<h3>Objective</h3>
<p>'.$row['objective'].'</p><br>
<h3>Process</h3>
<p>'.$row['process'].'</p><br<br><br>
<h3>THIS SECTION of the portfolio is under construction. Please feel free to browse the thumbnails below this framne.</h3>
</article>
';
echo ' <div id="align_left" style="float:right; width:50%;">
<div id="image_container" style="text-align:left; float:right; padding-right:20px; padding-bottom:3em;">
<div><a href="test_gallery/uploads/'. $file .'" title="'.cleanString($file).'" target="_blank"><img src="test_gallery/thumbnails/thumb_'.$row['id'].'.jpeg" width="333" height="500" alt="image" /></a> <br></div>
</div>
</div>
<br>
</div>
';
}
?>
<?PHP include "photo_gall_bottom.php"; ?>
<?PHP include "footer.php"; ?>[/code]