Hey guys. I am not a programmer and would appreciate some help. The code below shows 10 video thumbnails in a row. I just need to add a break so it create 2 rows of 5 instead of 1 row of 10. Thanks in advance. <? $result=mysql_query("select * from videos order by id DESC limit 10"); while($data=mysql_fetch_array($result)) { $then=strtotime($data[date]); $now = time(); $timediff = $then - $now; $dayspassed = intval(abs(((($timediff/60)/60)/24))); if ($dayspassed == 0) { $dayspassed="added today"; } elseif ($dayspassed == 1) { $dayspassed="added yesterday"; } else { $dayspassed="added $dayspassed days ago"; } if($data['th_default']) { if($data[scatid]) { $img_src = "/thumbs/default/s$data[scatid].jpg"; } else { $img_src = "/thumbs/default/$data[catid].jpg"; } } else $img_src = "/thumbs/$data[id].jpg"; ?> <td width="120" align="center"><a href="/view.php?a=v&t=<?=$data[id]?>"> <img alt="<?=$data[title]?> <?=$dayspassed?>" width="100" height="82" src="<?=$img_src?>" border="0" class="bgbox" /></a><br /> <? if (strlen($data[title]) > 15) { echo substr($data[title],0,15)."..."; } else { echo $data[title]; } ?> </td> <? } ?> </tr> </table> PHP:
Increment a variable by one every time eg $x = $x++; then if ($x == 5) { echo "<br> or <p>";} to make a new line?
Thanks thus far. Here is the error I receive: The entire line 64 is just one character }. I tried removing that and I had no luck.
<? $result=mysql_query("select * from videos order by id DESC limit 10"); $i = 0; while($data=mysql_fetch_array($result)) { $then=strtotime($data[date]); $now = time(); $timediff = $then - $now; $dayspassed = intval(abs(((($timediff/60)/60)/24))); if ($dayspassed == 0) { $dayspassed="added today"; } elseif ($dayspassed == 1) { $dayspassed="added yesterday"; } else { $dayspassed="added $dayspassed days ago"; } if($data['th_default']) { if($data[scatid]) { $img_src = "/thumbs/default/s$data[scatid].jpg"; } else { $img_src = "/thumbs/default/$data[catid].jpg"; } } else $img_src = "/thumbs/$data[id].jpg"; if ($i == 5) { echo "</tr></tr>"; } ?> <td width="120" align="center"><a href="/view.php?a=v&t=<?=$data[id]?>"> <img alt="<?=$data[title]?> <?=$dayspassed?>" width="100" height="82" src="<?=$img_src?>" border="0" class="bgbox" /></a><br /> <? if (strlen($data[title]) > 15) { echo substr($data[title],0,15)."..."; } else { echo $data[title]; } ?> </td> <? $i++; } ?> </tr> </table> PHP: I haven't looked at the code properly, but the error is echo "</tr></tr>"; the line above the one in the error, it almost always is with syntax errors, it means the line before isn't finished yet and it's expecting ; before the closing }
I am sorry i just forgot to put ; Its been a while i am working on ruby on rails and was missing with some syntax issues. Any ways nice to see your problem is resolved