|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Building a dynamic table with content
I currently have a working example that takes information from the database and populates a list of models, one per row. However I want to change the structure so I print out two models per row.
Here is the link to the current set up: URL And this is the code I used to create this page: <? echo "<center>"; $limit = 15; $query_count = " SELECT * FROM fse_model"; $result_count = mysql_query($query_count); $totalrows = mysql_num_rows($result_count); if(empty($page)) $page = 1; $limitvalue = $page * $limit - ($limit); $query = "SELECT * FROM fse_model ORDER BY id DESC LIMIT $limitvalue, $limit"; $result = mysql_query($query) or die("Error: " . mysql_error()); if(mysql_num_rows($result) == 0) echo("Nothing to Display!"); echo("<table width='550' border='0' cellpadding='5' cellspacing='0' bordercolor='#000000' bgcolor='#ffffff' style='border-collapse: collapse'>"); while($row = mysql_fetch_array($result)){ echo(" <tr> <td valign=\"top\"> <A HREF=\"model_gallery.php?id=".$row[id]."&name=".urlencode($row[name])."\"><img src=\"http://www.fifthsunentertainment.com/images/models/".$row[name]."/tn_".$row[name]."01.jpg\" width=\"65\" height=\"65\" alt=\"".$row[title]."\" border=\"1\"></a> </td> <td valign=\"top\"> <FONT SIZE=\"4\" FACE=\"verdana, arial, helvetica\" color=\"#000000\"><b>".$row[title]."</b></font> <br> <A HREF=\"javascript:newWindow('http://www.fsefilms.com/pop_m.php?id=".$row[id]."&name=".$row[name]."&title=".urlencode($row[title])."')\"><b>VIEW REEL HERE</b></a> <A HREF=\"model_gallery.php?id=".$row[id]."&name=".urlencode($row[name])."\"><b>VIEW PICTURE GALLERY</b></a><br> <A HREF=\"resume/".$row[resume]."\" target='_blank'><b>View ".$row[title]."'s Resume</b></a><br> <a href='mailto:".$row[agent]."@fifthsunent.com?subject=Contact ".$row[title]."'>Contact ".$row[title]." by email</a></b> </td> </tr> <tr> <td colspan=\"2\"> </td> </tr> "); } echo("</table><BR>"); if($page != 1){ $pageprev = $page - 1; echo("<a href=\"models.php?page=$pageprev\" class=\"ltblue12b\">PREV</a> "); }else echo("<font size='-2' color='#000000'>PREV</font> "); $numofpages = $totalrows / $limit; for($i = 1; $i <= $numofpages; $i++){ if($i == $page) echo($i." "); else echo(" <a href=\"models.php?page=$i\" class=\"ltblue12b\">$i</a> "); } if(($totalrows % $limit) != 1){ if($i == $page) echo($i." "); }else echo(" <a href=\"models.php?page=$i\" class=\"ltblue12b\">$i</a> "); if(($totalrows - ($limit * $page)) > 0){ $pagenext = $page + 1; echo("<a href=\"models.php?page=$pagenext\" class=\"ltblue12b\">NEXT</a>"); }else echo(" <font size='-2' color='#000000'>NEXT</font> "); mysql_free_result($result); mysql_close($cid); echo "</center>"; ?> |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > Building a dynamic table with content |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|