Page 1 of 1
loops again..
Posted: Thu May 04, 2006 3:43 pm
by corillo181
ok i already learn how to work to loop table <td> and <tr> with files in a directory.. but i can't get it to work the same way when pulling information from database..
wha ti want to know it how i can't work a <td> loop and <tr> loops into this code..
Code: Select all
while($code = mysql_fetch_array($q)) {
echo '<a href=3-11-06/'.$code['name'].'>'.'<img border=0 height=100 width=100 src="3-11-06/'.$code['name'].'"></a>';
}
and has to be widthing this code because i'm using pagination...
Posted: Thu May 04, 2006 3:49 pm
by feyd
As you've been told before, read the first two threads linked to from Useful Posts.
Posted: Thu May 04, 2006 4:57 pm
by corillo181
yes i seen it.. but is that the way yo put the looping prosses is too complicated for me..all thos eout put and stuff take me no where..i know you just gettign all the code into variable and echo it in jus tone line.. but still.. i dont get it..
Posted: Thu May 04, 2006 5:43 pm
by Christopher
Everything you need is in
that post that feyd pointed you to. There is not really an easier way to do it.
Posted: Thu May 04, 2006 6:12 pm
by corillo181
i came with this.. everything seen to be workikng fine.. i set the amount per pages to 4 and the pages shows but the pictures don't display
Code: Select all
while($code = mysql_fetch_array($q)) {
for($i=0; $i<$rows; $i++) {
echo '<tr>';
for($col=1;$col<=4;$col++) {
echo '<a href=3-11-06/'.$code['name'].'>'.'<img border=0 height=100 width=100 src="3-11-06/'.$code['name'].'"></a>';
}
echo"</tr>";
}
}
Posted: Fri May 05, 2006 12:46 am
by dibyendrah
To display you need the <TD> html tag which you haven't written . Code must be like this if the $code['name'] stores the image name :
Code: Select all
while($code = mysql_fetch_array($q)) {
for($i=0; $i<$rows; $i++) {
echo '<tr>';
for($col=1;$col<=4;$col++) {
echo '<td><a href=3-11-06/'.$code['name'].'>'.'<img border=0 height=100 width=100 src="3-11-06/'.$code['name'].'"></a><td>';
}
echo"</tr>";
}
}
Cheers,
Dibyendra
Posted: Fri May 05, 2006 11:05 am
by corillo181
yeah thans, i already got it to work soe other crazy way, but i guess i'll change it to this if it works is easier to understand, thanx
