Hi I’m using this code to generate an image from a database, Now I 've got a basic knowledge of PHP and it’s been a while since I’ve done much with it. I have a list of links being generated on one part of my site and when the user clicks these links it changes the project being displayed using a url query string.
My trouble is when the user gets to the page the first time there is no string. All I can understand is I will need to somehow detect a NULL value and send it to the last item in the database. I just cant seem to get this to work?
If anyone knows how I’d be very great full.
$result = mysql_query('SELECT * FROM tblProjects WHERE id = '.$_GET['project'].'') or die('<p>error querying projects database</p>');
$i = 0;
while($result_ar = mysql_fetch_assoc($result)){
?>
<img src="<?php echo $result_ar['largeImage']; ?>" alt="Latest Project" title="Latest Project" />
<p><?php echo $result_ar['name']; ?></p>
<div class="details">
DATE: <?php echo $result_ar['date']; ?> | CLIENT: <?php echo $result_ar['client']; ?> <br />ROLE: <?php echo $result_ar['role']; ?> | TECH: <?php echo $result_ar['tech']; ?><br /><a href="<?php echo $result_ar['link']; ?>">(view site)</a>
</div>
<?php
$i+=1;
}
?>
David