OK I want to show my visitors the last added gallery image. I have a table called gallery with the following fields id(primary), imgTitle, fileName, author, createDate. At he moment i only have on image in there but im just testing it. Anyway what do I do? I already have the connection i just need to code to select and display it.
This is my first time using php&mysql so keep answers simpl!
Comments
[PHP]
<?php
$query = mysql_query("SELECT * FROM `table_name` ORDER BY `id` LIMIT 1");
while ( $row = mysql_fetch_array ( $query ) ) {
echo $row["img_title"];
}
?>
[/PHP]
I hope it helps
Photoshop Tutorials- Coming soon
Premium PHP Scripts- Coming soon
Haha i should really do some work so i can remove all the coming soon's
[PHP] $result = mysql_query("SELECT fileName,imgTitle FROM gallery ORDER BY createDate DESC LIMIT 1");
$row = mysql_fetch_array($result);
echo "<img src=\"{$row}\" alt=\"{$row}\" />"; [/PHP]
sebastianastill.co.uk - My Portfolio
sebastianastill.co.uk - My Portfolio