adyre Posted May 23, 2006 Share Posted May 23, 2006 I have thisd code:<? if(!empty($_GET['cat'])) { $td = 3; $tr = 10; $total = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM subcat WHERE id_cat='".$_GET['cat']."'"),0) or die (mysql_error()); if($total == 0){ print "Nu exista inregistrari!"; } elseif(!isset($_GET['pag'])){ $pag =1; } else{ $pag = $_GET['pag']; } $sql = mysql_query("SELECT * FROM subcat WHERE id_cat='".$_GET['cat']."' ORDER by nume ASC limit ".(($pag * ($td * $tr)) - ($tr * $td)).",".($tr * $td)." ") or die (mysql_error()); $pag_total = ceil($total/($tr * $td)); if($pag > $pag_total){ print "Nu exista inregistrari!"; } elseif($pag_total > 0) { $settd=0; ?> <table width="100%" cellspacing="0" cellpadding="0" border="0"> <tr> <? while($row = mysql_fetch_array($sql)){ if($settd == $td) { print "</tr><tr>\n"; $settd=0; } elseif($settd != $td) { $settd++; ?> <td align="center" valign="middle"><?=$row['id']?> - <?=$row['nume']?></td> <? } } } print "</tr></table>"; }?>Problem: It show from database all without a row.If I remove:<?elseif($settd != $td) { $settd++; ?> <td align="center" valign="middle"><?=$row['id']?> - <?=$row['nume']?></td> <? }?>it show's all my rows, but ofcourse it doesen't show's me the results on columns.Any other ideea... Quote Link to comment https://forums.phpfreaks.com/topic/10232-multiple-column-display-results/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.