helow
i want display 4 records like images in one row and then should be move next row again should be display 4 record then move next row.
pls help me
thanks
Make a row with images
Moderator: General Moderators
-
shafiq2626
- Forum Commoner
- Posts: 88
- Joined: Wed Mar 04, 2009 1:54 am
- Location: Lahore
- Contact:
Make a row with images
Last edited by shafiq2626 on Thu Mar 19, 2009 11:31 am, edited 1 time in total.
Re: Make a row with images
I doubt anyone here will write it out for you. If you'd like help please post what you have so far.shafiq2626 wrote:helow
i want to get the records from database with while loop. and want to display 4 records like images in one row and then should be make next row in which also should be display 4 record then move next row.
pls help me
thanks
-
shafiq2626
- Forum Commoner
- Posts: 88
- Joined: Wed Mar 04, 2009 1:54 am
- Location: Lahore
- Contact:
Re: Make a row with images
Just Copy This Code
Code: Select all
<?php
[color=#FF0000]
$query = mysql_query("Select * from tbl_madanijadwal");
$i = 0;
while ($row = mysql_fetch_array($query))
{
if ($i % 4 == 0)
echo "<td>".$row["manues"]."</td>";
$i++; [/color]}
?>Re: Make a row with images
Have you tried using a count function?
-
crazycoders
- Forum Contributor
- Posts: 260
- Joined: Tue Oct 28, 2008 7:48 am
- Location: Montreal, Qc, Canada
Re: Make a row with images
What i usually do for this is the following:
Edit: The problem with this is that it forgets empty cells in the last row which is not XHTML compliant and it creates an empty row at the beginning which is not XHTML compliant too.
Code: Select all
$irecord = 0;
echo '<table><tr>';
while($record = mysql_fetch_assoc($records)){
if(($irecord % 4) == 0){
echo '</tr><tr>';
}
echo '<td>content</td>';
$irecord++;
}
echo '</tr></table>';