img loop from mysql stored path. – PHP



hello –

i need to implement this script to use a counter as to out put the data in columns and rows.

this pulls the data fine no problem just need to lay the data out instead of just in rows. i’ve tried adding tbl row headers, arrays, but this (do while) errors on me.

I dont know what im not doing correct.

here is my sample code with out the array or db links. just echoing the image.

im using cs4 dw.

<?php do { ?>
<td align="center" ><p><?php echo $row_image['description']; ?> </p>
<p><img src="<?php echo $row_image['file-system']; ?>" height="120" width="120" align="middle" /></p></td>
<?php } while ($row_image = mysql_fetch_assoc($image)); ?>

thanks in advance for your help,

theo werntz


There is a fundamental difference between the do-while loop and the while loop. With the do-while loop, the code between the curly-braces is always executed at least once with disregard to what happens in the while’s parenthesis. That is, the variable $row_image is defined only after the first execution of the loop. Therefore, in the do-while loop, you are initially making a call to an undefined variable

This can be correct by making the loop a while loop instead.


thanks for the reply. i like the do while loop. will repost once resolved. i found out what was the error.

thanks again.


i’ve completed it thanks. can you send me a link with all the articles that you guys have covered already? it seems that im running into issues that are already have been solved or other techniques on solving.


I suggest if you run into any issues that you look into them and find solutions yourself (Many can be found within our site).

While we like to be helpful and share our knowledge, we do not see ourselves as clerks to the membership. You will need to do your own leg-work I’m afraid.


sure not a problem. this is the methodology that i have been using, doing my own work; trying to find resolutions or new insights on debugging.

i was just inquiring about the insights that you have, below the answers. is their another link or sub domain name that has the articles where people ( members, moderators, admins, etc… ) write articles?


The insights section is where members articles are written. There is an insights section in each forum.