#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    56
    Rep Power
    2

    Help create a table template


    Hi,

    I am wondering how I can create a table to display data from MySQL database in a pattern like a chess board, instead of continuous data-grid.

    I intend to display images this way.

    I will appreciate your help.

    Joseph
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    7
    Rep Power
    0

    Create a table template


    We create more table template in HTML web designing. But today table is then use as compare to div class in html. Because it is so easy.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    56
    Rep Power
    2

    Help create a table template


    Originally Posted by toddyaww
    We create more table template in HTML web designing. But today table is then use as compare to div class in html. Because it is so easy.
    Ok, the following is the table I want replaced with DIVs function:

    Code:
    <table width="800" border="0" align="left" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">    <tr>     <td>       <table width="750" border="0" align="left" cellpadding="0" cellspacing="0">         <tr>           <td align="left"> <? echo "<div align=right>$text</div>"; echo "<table width=700 border=0 cellpadding=0 cellspacing=0 align=left>\n <tr>\n 	<td> Total No of Records Found: $num &nbsp; \n 	<td> &nbsp;\n 	 </tr>\n <tr> \n";  //part of paging code     if($num) ////////////////// $i=0; $counter=0; while($row=mysql_fetch_array($result)) { 	$sn=$row['m_id']; 	$mtitle=$row['mtitle']; 	$mfilename=$row['mfilename']; 	 	if($counter>=0) { 	echo "<td valign=top>\n 	 	<table width=150 border=0 align=left class=allborder> \n 	<tr> \n 		<td width=70>$mtitle</td> \n 		 	</tr>\n 		<tr> \n 		<td><a href=details.php?m_id=$sn><img src=\"./images/{$row['mfilename']}\" width=\"90\" height=\"120\" alt=\"\" /></a> \n 		 		</td> 	</tr>\n 		 	</table>\n</td>\n 	 "; 	 $counter++; 	 }  	 if($counter==5) { 	 	echo "</tr>\n<tr>\n<td colspn=2>&nbsp; \n</tr>\n<tr>\n"; 		$counter=0; 	 } }	  echo "</table>\n"; ?></td> 	    </tr>     </table></td> <td>  </td>      </tr> </table>

    My try was I didn't know how to completely replace the table, so I started with the part that returns the query results leaving the rest as it was:

    Code:
    <div class="ad"> \n 	  <class="image"/><td><a href=details.php?m_id=$sn><img src=\"./images/{$row['mfilename']}\" width=\"90\" height=\"120\" alt=\"\" /><br /> \n 	  <span class="text">$mtitle</span> \n 	</div> \n
    But here I got an error:

    Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in C:/Program ... on line 210
    Line 210 is
    <div class="ad"> \n
    I will appreciate any help with this.

    Joseph

IMN logo majestic logo threadwatch logo seochat tools logo