Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Jun 2001
Posts: 176
Member
Member
Offline
Joined: Jun 2001
Posts: 176
ok I'v been working on a little image gallery
but my query is only returning 1 image with comment
code:
// do query for user images ,comments-------------------------------------------------
$query = "
SELECT G_username,G_image,G_comments
FROM w3t_Gallery
WHERE G_username = '$Username'
";
$sth2 = $dbh -> do_query($query);
list ($Username,$Gimage,$Gcomments) = $dbh -> fetch_array($sth2);
$dbh -> finish_sth($sth2);
$Pic = "<img width=200 height=150 src = "$Gimage" alt="$Username">";

// end do query for user image ,comments--------------------------------------------


code:

echo"<TR><TD><a href="$Gimage">$Pic<br><center>$Gcomments</center></TD></TR></TABLE>";



now there are 5 results it should return but only retuning 1

help can you see what I did wrong

Last edited by Dslam; 07/19/2002 3:26 PM.
Sponsored Links
Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
You need a loop:

code:
// do query for user images,comments
$query = "
SELECT G_username,G_image,G_comments
FROM w3t_Gallery
WHERE G_username = '$Username'
";
$sth2 = $dbh -> do_query($query);
// end do query for user image,comments

while (list ($Username,$Gimage,$Gcomments) = $dbh -> fetch_array($sth2)) {
$Pic = "<img width=200 height=150 src = "$Gimage" alt="$Username">";
echo"<TR><TD><a href="$Gimage">$Pic<br><center>$Gcomments</center></TD></TR></TABLE>";
}
$dbh -> finish_sth($sth2);



Joined: Jun 2001
Posts: 176
Member
Member
Offline
Joined: Jun 2001
Posts: 176
ok got ya
Thank you

Joined: Jun 2001
Posts: 176
Member
Member
Offline
Joined: Jun 2001
Posts: 176
humm if you don't mind can you tell me how to limit to 4 images per row ,after displaying 4 images & want it to go next line.


sorry I'm new to this & this is my first program
but I'm trying guess thats what counts


edit never mind I got it

Last edited by Dslam; 07/22/2002 1:42 PM.

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
• Shock Hosting
• Stable Host
• bluehost
• InterServer
Visit us on Facebook
Member Spotlight
AllenAyres
AllenAyres
Texas
Posts: 21,080
Joined: March 2000
Forum Statistics
Forums63
Topics37,583
Posts293,957
Members13,826
Most Online151,614
Nov 14th, 2025
Today's Statistics
Currently Online 34299
Topics Created 0
Posts Made 0
Users Online 1
Birthdays 1
Top Posters
AllenAyres 21,080
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,834
Greg Hard 4,625
Top Posters(30 Days)
isaac 2
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2026 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.1.0
(Snapshot build 20261026)