Did the code work before you altered it with the counter (displaying everything on one row it appears)?
Don't change the "=" to "==" in the while statement, that will destroy the boleean logic. With one "=" sign, it's telling the program to stay in the loop as long as query is retrieving data. When the internal 'while' iterator reaches the last result set, it comes up 'false' and the loop breaks.
You counter doesn't make sense though. (I don't know if it's WDF that inserts all the underscore lines, but if they exist in your code you should remove them.) In your If statement you're comparing $counter to $column which are both set to '0' on top of your script. That means the clause will never be true as the value of "$counter" will have the value of 1 the first time the comparison is made, and thereafter only increase.
What you could do is:
PHP Code:
# Change $columns=0 to $i=0 outside loop to begin with
$counter++;
$i++;
if ($counter==3)
{
# The while clause is to prevent an empty <tr> after last image
while ($i<mysql_num_rows($mostRecent))
{
echo "</tr>\n<tr>";
$counter=0;
}
}
EDIT:
In the future when you make a post containing either the PHP or CODE BB-tags, be aware that WDF ignores word wrapping for any text inside these tags. That means that your posted code will expand the column to fit the length of the text line. If you write a 6 feet long line without a line break, then we will have to scroll 6 feet horizontally to read your post
Last edited by rosland; February 14 '04 at 06:13 AM.
|