I created a database with a single table. I created 3 more columns inside that table. then i queried and printed it using fetch_array. i worked. but it displays like but i want it to be like this is the code i use now
Untested, but give this a try. <table border="1"> <tr> <?php $int = 0; while($row = mysql_fetch_array($sql)) { echo "<td><a href=".$row['name'].">".$row['name']."</a></td>\n"; echo ++$int % 2 == 0 ? '</tr><tr>' : ''; } ?> </tr> </table> Code (markup):
i will try it i will make it more clear i want the contents to be displayed like in a link directory.
I can't say without seeing your database structure and knowing which data... http:// dev.mysql.com/doc/refman/5.0/en/insert.html
This might help more. http:// phpeasystep.com/mysql/5.html http:// infinite-fire.net/tutorials/php/insert-data-into-a-mysql-database
More dynamic: <?php //Coulmn Display Limit $DIS_LIM = 3; echo '<table width="100%" border="0" cellspacing="0" cellpadding="2">'; $x=1; while($row = mysql_fetch_array($sql)){ if($x == 1){ echo'<tr>';} echo "<td><a href=".$row['name'].">".$row['name']."</a></td>\n"; if($x == $DIS_LIM){ echo '</tr>';$x=0;} $x++; } if($x != 1){ for($z=0;$z<=$DIS_LIM-$x;$z++){ echo '<td> </td>';} echo '</tr>'; } echo '</table>'; ?> PHP: Peace,