Hello guys,
I'll try and explain in full.
I have 2 tables in my database ( extras, extraphotos ).
Table extras is holding the title, descr and extraphotos is holding the picname. Both of the have an extra row with the name of fname so i can bind these two together.
What I'm trying to do is to read from my DB the Title, Description and all the picname for a gallery that i'm trying to create.
Basically it is set up with the Cycle js plugin so I have 1 thumbnail that has extra photos ( picname ).
I'm struggling to get arround on this ->
So basically my first 'while loop' is creating the divs for the thumbnails, and i need a second 'while loop' so it can create the extra photo divs inside the main one.
Any suggestions? I started coding like 2 weeks ago and I thought it would be easier. ^_^
Thanks in advance,
Xenos K.
I'll try and explain in full.
I have 2 tables in my database ( extras, extraphotos ).
Table extras is holding the title, descr and extraphotos is holding the picname. Both of the have an extra row with the name of fname so i can bind these two together.
What I'm trying to do is to read from my DB the Title, Description and all the picname for a gallery that i'm trying to create.
Basically it is set up with the Cycle js plugin so I have 1 thumbnail that has extra photos ( picname ).
I'm struggling to get arround on this ->
Code:
<?php $query="SELECT * FROM extras"; $result=mysql_query($query); $num=mysql_numrows($result); $i=0; $j=0; while ($i < $num) { $descr=mysql_result($result,$i,"descr"); $title=mysql_result($result,$i,"title"); $fname=mysql_result($result,$i,"fname"); echo '<div class="image" title="'.$title.'">'; echo '<img src="http://bytes.com/images/work/th/kolie1.jpg" alt="" />'; echo '<div class="image-label"><span>'.$title.'</span></div>'; echo '</div>'; echo '<div class="cycle">'; $query2="SELECT * FROM extraphotos WHERE fname = " .$fname; $result2=mysql_query($query2); $num2=mysqlnumrows($result2); while ($j < $num2) { $picname=mysql_result($result2,$j,"picname"); echo '<img src="http://bytes.com/images/work/"'.$picname.'.jpg" width="710px" height="460px" />'; $j++; } echo'</div>'; echo '<div class="info">'; echo '<div class="title"><h2>'.$title.'.</h2></div> '; echo '<div class="descr">'.$descr.'</div>'; echo '<div class="item_url">'.$fname.'</div>'; echo '</div>'; echo '</div>'; $i++; } ?>
Any suggestions? I started coding like 2 weeks ago and I thought it would be easier. ^_^
Thanks in advance,
Xenos K.
Comment