| 
	
 | 
 Posted by ste on 06/21/92 11:46 
"Rik" <luiheidsgoeroe@hotmail.com> wrote in message  
news:e2ukl5$gft$1@netlx020.civ.utwente.nl... 
> Why don't I see the bumber three anywhere in the code? Have you tried  
> making 
> it 3 rows?  How? 
> 
> 
> But I'm in a generous mood tonight: 
> echo "\n<table>"; 
> $i = 3; 
> while ($row = mysql_fetch_assoc($result)) 
> { 
>    if($i==3) echo "\n\t<tr>"; 
>    echo "\n\t\t<td><img src=\".$row['imagelocation']." /></td>"; 
>    $i--; 
>    if($i==0) { 
>        echo "\n\t<tr>"; 
>        $i = 3; 
>    } 
> } 
> if($i!=3) echo "\n\t\t<td colspan=\"$i\"></td>\n\t</tr>"; 
> echo "\n</table>"; 
> 
> Grtz, 
> --  
> Rik Wasmus 
 
Hi Rik, 
 
I had two main outcomes when trying to write the code for this - the one you  
saw in my post (which posted 1 image per table row), and another one which  
did post 3 images per row, but each row contain identical images (i.e. it  
was just duplicating code, as opposed to inserting the next record/image).  
As I've not yet grasped enough skills with PHP yet, and in my frustration of  
nearly seeing what I was hoping for, I completely overlooked the fact that  
the number 3 should be in my code at some point! :-S 
 
Thank you for being in such a generous mood and posting the above code, it's  
appreciated! :-) 
 
When I first ran it, I had a message saying "Parse error: parse error,  
unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or  
T_NUM_STRING" on the line containing the code 'imagelocation' above. 
 
I googled this message and found the solution was to remove the apostrophe's  
surrounding ['imagelocation'], and this now works great!  I also inserted a  
\ in front of the quotation mark after imagelocation, but I'm not sure if  
this made any difference at all. 
 
Thanks again, I'd have *never* have gotten there with this assistance. 
 
Ste
 
  
Navigation:
[Reply to this message] 
 |