Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hello,
im pretty new to actually coding anything serious in PHP so this is a 1st attempt made of tutorials and other things...
Anyway basically i want to create a version of an image gallery that retrieves the following info from the DB:
image : a link
text: the description
pimage: another image...
i have managed to set it so that when it retrieves the data it writes in inside <img> tags making it an image....
ive probably gone about this all the wrong ways, but im stuck i can retrieve two seperate sets of data from the DB and display it properly but i want to be able to create a button that will allow me to navigate forward and backwars between SQL records therefore displaying the different images and text..
Here is what ive got so far...Code: Select all
<?php
$conn = @mysql_connect( "localhost" , "admin", "password removed for security " )
or die (" Err:Conn" );
$rs = @mysql_select_db( "portfolio", $conn )
or die ("Err:Db");
$sql = ('SELECT * '
. ' FROM `id` '
. ' WHERE 1 AND `id` =1 LIMIT 0, 30');
$sql1 = ('SELECT * '
. ' FROM `id` '
. ' WHERE 1 AND `id` =2 LIMIT 0, 30');
$rs = mysql_query ($sql,$conn );
$rs1 = mysql_query ($sql1,$conn );
while ( $row = mysql_fetch_array( $rs ) )
{
echo ("<br><br>");
echo ('<img src="');
echo ("" . $row["image"] );
echo ('"></img>');
echo ('<br><br>');
echo ("" . $row["text"] );
echo ("<br><hr>");
echo ("" . $row["pimage"] );
}
while ( $row = mysql_fetch_array( $rs1 ) )
{
echo ("<br><br>");
echo ('<img src="');
echo ("" . $row["image"] );
echo ('"></img>');
echo ('<br><br>');
echo ("" . $row["text"] );
echo ("<br><hr>");
echo ("" . $row["pimage"] );
}
?><br>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]