thefreebielife Posted June 13, 2007 Share Posted June 13, 2007 This script: <?php <table style="border:1px solid #0099CC; width:635px; font-size:12px; margin-left:80px;" cellpadding="2" cellspacing="0"> <tr> <td colspan="4" style="border-bottom:1px solid #0099CC" bgcolor="#CC00FF"><div align="center"><strong>News</strong></div></td> </tr> <tr bgcolor="#CCEAEA"> <td width="15%" style="border-bottom:1px solid #0099CC"><div align="center">Date </div></td> <td width="15%" style="border-bottom:1px solid #0099CC"><div align="center">User Posted</div></td> <td width="50%" style="border-bottom:1px solid #0099CC"><div align="center">Title</div></td> <td width="20%" style="border-bottom:1px solid #0099CC"><div align="center">View</div></td> </tr> <? $sql = "SELECT * FROM news order by date DESC"; $result = mysql_query($sql); $i=0; while($r=mysql_fetch_array($result)) { $i=$i+1; ?> <tr bgcolor="#<?= ($i++%2) ? 'FFFFFF' : 'F5F5F5' ?>"> <td width="15%" style="border-bottom:1px dashed purple; border-right:1px dashed purple"><div align="center"><FONT SIZE="2"><? echo $r["date"]; ?></FONT></div></td> <td width="15%" style="border-bottom:1px dashed purple; border-right:1px dashed purple"><div align="left"><FONT SIZE="2"> <? echo $r["user"]; ?></FONT></div></td> <td width="50%" style="border-bottom:1px dashed purple; border-right:1px dashed purple"><div align="center"><FONT SIZE="2"><? echo $r["title"]; ?></FONT></div></td> <td width="20%" style="border-bottom:1px dashed purple; border-right:1px dashed purple"><div align="center"><FONT SIZE="2"><a href="viewnews.php?newsID=<? echo $r["newsID"]; ?>">View</a></FONT></div></td> </tr> <? } if($i==0) { ?> <tr> <Td colspan=3 align="center"><FONT SIZE="2" COLOR="#FF0000"><B>There are news articles submitted.</B></FONT></Td> </tr> <? } ?> </table> <p> <p> php?> Is causing this one.. <?php <table width="400" style="border:1px solid #0099CC; width:735px; font-size:12px; margin-left:30px;" cellpadding="2" cellspacing="0" class="reftable"> <tr> <td colspan="2" style="border-bottom:1px solid #0099CC"><div align="center"><strong>Your Referrals </strong></div></td> </tr> <tr bgcolor="#CCEAEA"> <td width="50%" style="border-bottom:1px solid #0099CC"><div align="center">Username</div></td> <td width="50%" style="border-bottom:1px solid #0099CC"><div align="center">Offer Status</div></td> </tr><? if ($count == 0) { ?> <tr> <td colspan="2"><div align="center"><font color="#FF0000">You Have No Referrals</font></div></td> </tr> <? } ?> <? //grab all the content while($r=mysql_fetch_array($result)) { $ruser=$r["username"]; $roffer=$r["ostatus"]; ?> <tr bgcolor="#<?= ($i++%2) ? 'FFFFFF' : 'F5F5F5' ?>"> <td width="50%" style="color:#0099FF "><div align="center"><? echo "$ruser"; ?></div></td> <td width="50%"><div align="center"><? if ($roffer == 1) { echo "<font color=#009900>Offer Completed</font>"; } else if ($roffer == 0.2) { echo "<font color=red>Completed 1/5 Credits</font>"; } else if ($roffer == 0.4) { echo "<font color=red>Completed 2/5 Credits</font>"; } else if ($roffer == 0.6) { echo "<font color=red>Completed 3/5 Credits</font>"; } else if ($roffer == 0. { echo "<font color=red>Completed 4/5 Credits</font>"; } else if ($roffer == 0) { echo "<font color=red>Offer Not Completed</font>"; } else if ($roffer == 2) { echo "<font color=red>User Removed</font>"; } ?> </div></td> </tr> <? } ?> <? //grab all the content while($r=mysql_fetch_array($result)) { $ruser=$r["username"]; $roffer=$r["ostatus"]; ?> <tr> <td width="50%" style="color:#0099FF "><div align="center"><? echo "$ruser"; ?></div></td> <td width="50%"><div align="center"><? if ($roffer == 1) { echo "<font color=#009900>Offer Completed</font>"; } else if ($roffer == 0.2) { echo "<font color=red>Completed 1/5 Credits</font>"; } else if ($roffer == 0.4) { echo "<font color=red>Completed 2/5 Credits</font>"; } else if ($roffer == 0.6) { echo "<font color=red>Completed 3/5 Credits</font>"; } else if ($roffer == 0. { echo "<font color=red>Completed 4/5 Credits</font>"; } else if ($roffer == 0) { echo "<font color=red>Offer Not Completed</font>"; } else if ($roffer == 2) { echo "<font color=red>User Removed</font>"; } ?> </div></td> </tr>> <? } ?> </table> <p> Not to display any of the info called on. I know this because if i take the top one out, the bottom works fine. these ARE in the same file i am completely confused here. the "<?php's" arent really there Quote Link to comment Share on other sites More sharing options...
btherl Posted June 13, 2007 Share Posted June 13, 2007 If you want to go back over a set of rows from mysql, you must use this function: http://sg2.php.net/manual/en/function.mysql-data-seek.php eg msql_data_seek($result, 0); Quote Link to comment Share on other sites More sharing options...
thefreebielife Posted June 13, 2007 Author Share Posted June 13, 2007 this is a different set in a different table, i tried that but it doesnt work Quote Link to comment Share on other sites More sharing options...
btherl Posted June 20, 2007 Share Posted June 20, 2007 If it's a different set in a different table, then you need a new mysql_query(). You can't use mysql_fetch_array() until you've called mysql_query() Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.