unidox Posted September 24, 2007 Share Posted September 24, 2007 I have this code now: <?php $mysql_table = "cp_roster"; require_once ("inc/required.inc.php"); $result = MYSQL_QUERY("SELECT * FROM $mysql_table ORDER BY type ASC") or die (mysql_error()); $rows = mysql_num_rows($result); if ($rows == "0") { echo "<b>No Members in the roster database table.</b>"; } else { echo '<table border="0" align="center" cellpadding="0" cellspacing="3">'; $i = 0; while ($mysql=mysql_fetch_array($result)) { $i++; if ($i == 1) echo '<tr bgcolor="#2A3133">'; if ($mysql[image] !== "0") { ?> <td style="border: 1px solid rgb(42,49,52)"><a href="index.php?id=roster&roster_id=<?=$mysql[roster_id]?>"><img src="<?=$imagefilepath . 'rosterpic' . $mysql[roster_id] . '.' . $mysql['imagetype']?>" width="45" height="45" border="0" onmouseover="swapOnRoster('<?=$mysql[first]?>','<?=$mysql[last]?>','<?=$mysql[alias]?>')" onmouseout="swapOffRoster()"></img></a></td> <? } else { ?> <td style="border: 1px solid rgb(42,49,52)"><a href="index.php?id=roster&roster_id=<?=$mysql[roster_id]?>"><img src="pics/roster.gif" width="45" height="45" border="0" onmouseover="swapOnRoster('<?=$mysql[first]?>','<?=$mysql[last]?>','<?=$mysql[alias]?>')" onmouseout="swapOffRoster()"></img></a></td> <? } if ($i == 4) { echo '</tr>'; $i = 0; } } if ($i != 0) echo '</tr>'; echo '</table><div id="handleDivision"> <div align="center" id="rosterHandle">Select to view profile</div> <div class="clearBoth"></div></div>'; } ?> In the cp, I have added a divisions page so people can add like 1.6 and stuff, but I was wondering how I can go about doing that. In the table(cp_divisions) I have 2 rows, one for image, and one for name. I am trying so if there is no image it echos the text, but if there is an image, it echos the image. The problem is how will I manage the pagination and I think I would need another while in order to echo the images for the divisions. Can anyone help? Thanks in advance Link to comment https://forums.phpfreaks.com/topic/70514-while/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.