View Single Post
  #13   Spotlight this post!  
Unread 09-07-2007, 16:07
Travis Hoffman's Avatar Unsung FIRST Hero
Travis Hoffman Travis Hoffman is offline
O-H
FRC #0048 (Delphi E.L.I.T.E.)
Team Role: Engineer
 
Join Date: Sep 2001
Rookie Year: 2001
Location: Warren, Ohio USA
Posts: 4,047
Travis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond repute
Re: Dynamic Tables in PHP

F, I'm just a dumb C-programmer (emphasis on dumb), but I think you are "wasting" a fetch of the Picture 6 data at the entry to the while loop before your final end of row check (if counter == limit) takes place within the loop. You read the data but then your limit check kicks in, starts a new row, and resets the counter before anything is done with that data. You then exit the while loop and reenter it, fetching Pic 7 data, which becomes the first entry in your new row.

If you change your loop to look like this.......

PHP Code:
while($row mysql_fetch_assoc($results))  

        echo 
'<td><a href="' .$row[PICTURE_URL]. '" ><img src="' .$row[PICTURE_URL]. '" /></a><br>'//Echo a link to the image, and display the image as well 
 
        
echo 'Added to gallery:' .$row[PICTURE_DATE]. '</td>'//display the dat it was added 
 
        
$column_counter++; //Add one to the counter 
 
        
if($column_counter == $column_limit)     
        { 
 
                echo 
'</tr><tr>'//End current row, and start a new row 
                
                
$column_counter 0//reset the column counter 
        
        
}
 

I believe the code will produce the desired results. Please, all html/php junkies, confirm this.
__________________

Travis Hoffman, Enginerd, FRC Team 48 Delphi E.L.I.T.E.
Encouraging Learning in Technology and Engineering - www.delphielite.com
NEOFRA - Northeast Ohio FIRST Robotics Alliance - www.neofra.com
NEOFRA / Delphi E.L.I.T.E. FLL Regional Partner

Last edited by Travis Hoffman : 09-07-2007 at 16:10.