PHP Portfolio System Using SQL Backend (in devlelopment)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Duncan2006
Forum Newbie
Posts: 1
Joined: Sat Apr 08, 2006 4:55 pm

PHP Portfolio System Using SQL Backend (in devlelopment)

Post by Duncan2006 »

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]


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>
This is what that code returns: http://img398.imageshack.us/img398/7039/ss0yk.jpg (dual screen so scroll to right a bit)[/url]


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]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

search keyword: pagination
Post Reply