epic1231
08-28-2009, 11:47 PM
I have this code which is a form and gives me the ability to show users already stored in the database
<?
echo '<div id="top"></div>';
echo '<table align=center width=95% class="itemTable" border=0>';
echo '<tr>';
$res = query("SELECT * FROM `appusers` WHERE `userid`!=$user ORDER BY RAND() LIMIT 0,20");
$i=0;
while( $row = mysql_fetch_array($res) ) {
echo '<td><P class=bigBoldP><a href="'.$appCanvasUrl.'stat.php?id='.$row[userid].'"><fb:profile-pic uid='.$row[userid].' size=square width=75 height=75 linked=false /></a><BR><a href="'.$appCanvasUrl.'stat.php?id='.$row[userid].'">Agent '.$row[uCharName].'</P>';
if( $row[uHealth] <= 20 ){
echo '<BR><P class=bigBoldP>Too weak to fight</P>';
}
else {
echo '<BR><P class=bigBoldP>';
echo '<form ACTION="'.$appCanvasUrl.'fight/" method="POST" id="myform'.$i.'">';
echo '<input type=hidden name=oponentId id="opponentid'.$i.'" value="'.$row[userid].'">';
echo '<input type="hidden" name="top" value="#top">';
echo '<input type=hidden name="fightOponent" value="Attack"><input type="button" name="fightOponentg" value="Attack" onclick=\'submit_a("myform'.$i.'", "fight_response", "opponentid'.$i.'", "fightagain'.$i.'")\' id="fightagain'.$i.'" class="submitButton">';
echo '</form><BR>';
echo '</P>';
$i++;
}
echo '</td>';
echo '</tr>';
}
echo '</table>';
echo '<BR>';
require_once '../bottom.php';
?>
For some reason with changing my td's and tr's I can't seem to get it to output 4 rows of 5 column's each = the 20 items I am looking to pull
Any suggestions, I have done it before but lost the code and am drawing a complete blank this evening while working on it.
Thanks very much in advance!
-Bill
<?
echo '<div id="top"></div>';
echo '<table align=center width=95% class="itemTable" border=0>';
echo '<tr>';
$res = query("SELECT * FROM `appusers` WHERE `userid`!=$user ORDER BY RAND() LIMIT 0,20");
$i=0;
while( $row = mysql_fetch_array($res) ) {
echo '<td><P class=bigBoldP><a href="'.$appCanvasUrl.'stat.php?id='.$row[userid].'"><fb:profile-pic uid='.$row[userid].' size=square width=75 height=75 linked=false /></a><BR><a href="'.$appCanvasUrl.'stat.php?id='.$row[userid].'">Agent '.$row[uCharName].'</P>';
if( $row[uHealth] <= 20 ){
echo '<BR><P class=bigBoldP>Too weak to fight</P>';
}
else {
echo '<BR><P class=bigBoldP>';
echo '<form ACTION="'.$appCanvasUrl.'fight/" method="POST" id="myform'.$i.'">';
echo '<input type=hidden name=oponentId id="opponentid'.$i.'" value="'.$row[userid].'">';
echo '<input type="hidden" name="top" value="#top">';
echo '<input type=hidden name="fightOponent" value="Attack"><input type="button" name="fightOponentg" value="Attack" onclick=\'submit_a("myform'.$i.'", "fight_response", "opponentid'.$i.'", "fightagain'.$i.'")\' id="fightagain'.$i.'" class="submitButton">';
echo '</form><BR>';
echo '</P>';
$i++;
}
echo '</td>';
echo '</tr>';
}
echo '</table>';
echo '<BR>';
require_once '../bottom.php';
?>
For some reason with changing my td's and tr's I can't seem to get it to output 4 rows of 5 column's each = the 20 items I am looking to pull
Any suggestions, I have done it before but lost the code and am drawing a complete blank this evening while working on it.
Thanks very much in advance!
-Bill