Jump to content

display query n div per row


fatimamj

Recommended Posts

$id=$_GET['id']; $getnav_data= mysql_query("SELECT `c_name`,`cars_id` FROM `the_cars` WHERE `cat_id`=$id")or die(mysql_error());   // set up loop counter $col_count = 0; // start table and first tr ?>    <table  cellspacing="0" cellpadding="0" border="0" width="100%" style="margin:40px auto;">												       <?phpwhile($nav_data=mysql_fetch_array($getnav_data)){  $get_pic=mysql_query("SELECT `pics_path`,`pics_id` FROM `cars_pic` WHERE `cars_id`=$nav_data[cars_id]   ORDER BY `pics_id` DESC LIMIT 1")or die(mysql_error());  $picpath=mysql_fetch_array($get_pic);     // if you have output 3 cols then end tr and start a new one         if ($col_count == 4) {         echo '</tr><tr>';       //  and reset the col count         $col_count = 0;        }      // always output the td      //this new table after td is just to applay the pic and the name under each other       	     ?><td> <table border="0" width="100%" class="z-table">           <tr><td>		   <?php echo"<img src='hoss_admincp/$picpath[pics_path]' />";?>		   </td></tr>		   <tr><td style=" padding-top: 20px; padding-bottom: 20px; font-size: 14px;"><?php echo"<a href=projects.php?c_id=$nav_data[cars_id] style= 'color:black; text-decoration: none;'>$nav_data[c_name]<br></a>";?>		   </td></tr>		   </table>		   </td>						<?php // and count the column             $col_count++; }		?></tr></table>

hi all,

how can i implement the previous code using n div per row,i have tried many times but i failed in every time

any tip would appreciated

Link to comment
Share on other sites

first .many thanks all for your time and help,,

 

i am trying to get rid of tables when laying out interface coz i am stuck with tables till today no matter how hard i am trying to deal with divs

 

no need for tables in that case but do not how to do loop using while creating number of divs each row i do not want to use div inside tables

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...