Nodorino يامال العافية ..
اسمحلي بتعديل .. الكود لايطبع اغلاق الtr
كود PHP:
$cols = 4; // عدد الاعمدة
echo "<table border=\"1\" width=\"50%\">\n\r";
for($i = 0; $i < 20 ; $i++)
{
if( ($i % $cols == 0) )
echo "\t<tr>\n\r";
echo "\t\t<td> Text ...</td>\n\r";
if( $i % $cols == $cols-1 )
echo "\t</tr>\n\r";
}
echo '</table>';
وللاستعلامات
كود PHP:
$cols = 4; // عدد الاعمدة
$sql=mysql_query("select * from table_name");
echo "<table border=\"1\" width=\"50%\">\n\r";
for($i = 0; $sql && $row=mysql_fetch_array($sql) ; $i++)
{
if( ($i % $cols == 0) )
echo "\t<tr>\n\r";
echo "\t\t<td> $row[FIELD] ...</td>\n\r";
if( $i % $cols == $cols-1 )
echo "\t</tr>\n\r";
}
echo '</table>';