The_Dude_1978 Posted October 5, 2010 Share Posted October 5, 2010 Hi there, I hope somebody can help me creating a loop for the following code: What it currently does is, showing only 1 image, while in fact there are 3 of them. I've combined a loginsystem with slideviewer. When i use the original php code (or a part of it) it only shows one listing. I need it to list all of them. <div id="mygalone" class="svw"><ul> <li> <?php$result = mysql_query("SELECT reference FROM user_photos WHERE`profile_id`='".$row['id']."'");while ($row2 = mysql_fetch_array($result, MYSQL_ASSOC)){ echo "<a href=\"".$_GET['username']."/pics/".$row2['reference']."\"> <img src=\"".$_GET['username']."/pics/thumbs/".$row2['reference']."\"></a><br/><br/>";}}?> </li></div> What can be stripped down to this: <?php { $result = mysql_query("SELECT reference FROM user_photos WHERE`profile_id`='".$row['id']."'"); while ($row2 = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "<img src=\"".$_GET['username']."/pics/".$row2['reference']."\">"; } } ?> You would asume that this is allready a loop, but it does not act like it. Best regards, Martijn (the netherlands) [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/215224-how-to-create-a-loop-for-images-mysql-fileserver/ Share on other sites More sharing options...
litebearer Posted October 5, 2010 Share Posted October 5, 2010 Did you check to see how may rows are being returned by your query? Link to comment https://forums.phpfreaks.com/topic/215224-how-to-create-a-loop-for-images-mysql-fileserver/#findComment-1119361 Share on other sites More sharing options...
The_Dude_1978 Posted October 5, 2010 Author Share Posted October 5, 2010 No i did not check that. Can you tell me how to do that? Furthermore: I've been searching on internet for a solution, and a light hit me (god bless the angels). The code for the li was as follows: echo "<li><img src=\"".$_GET['username']."/pics/".$row2['reference']."\"></li>"; Now i got a list of 3 images as supposed to, BUT, the images are all the same. That does'nt match up, because there are 3 different images. Can you help me? Best regards, Martijn Link to comment https://forums.phpfreaks.com/topic/215224-how-to-create-a-loop-for-images-mysql-fileserver/#findComment-1119365 Share on other sites More sharing options...
The_Dude_1978 Posted October 5, 2010 Author Share Posted October 5, 2010 Hi there, I'm very sorry to have troubled you guy's looking at the code. Ok, i fixed the li problem myself, but i needed to use an old version of jquery easing. In the name of the 1.3 it was like jquery.easing.1.3.js but the old file i needed to use was jquery-easing.1.2.js. I only change from 3 to 2, but not from . to - . So in fact is all working, but the reference was'nt right. Sorry again. Best regards, Martijn Link to comment https://forums.phpfreaks.com/topic/215224-how-to-create-a-loop-for-images-mysql-fileserver/#findComment-1119382 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.