allworknoplay Posted February 19, 2009 Share Posted February 19, 2009 Nope, the table and its contents load perfectly but the background colors are not there. :-\ Ok so everything is perfect now except for the rotating background colors? Quote Link to comment Share on other sites More sharing options...
Lambneck Posted February 19, 2009 Author Share Posted February 19, 2009 well its basically back to square one now: trying to get the <tr> background colors to alternate. Quote Link to comment Share on other sites More sharing options...
Lambneck Posted February 19, 2009 Author Share Posted February 19, 2009 right now the <tr>'s are echoed with this result: <tr class="0 % 2 ? 'even' : 'odd'"> Quote Link to comment Share on other sites More sharing options...
allworknoplay Posted February 19, 2009 Share Posted February 19, 2009 right now the <tr>'s are echoed with this result: <tr class="0 % 2 ? 'even' : 'odd'"> Ok I get it, hold on i will give you the code. Quote Link to comment Share on other sites More sharing options...
allworknoplay Posted February 19, 2009 Share Posted February 19, 2009 Hopefully this will work. <?php $result = mysql_query("SELECT submission_id, col_1, name, submission_date FROM $table WHERE topic_id = '0' ORDER BY submission_id DESC"); if (!$result) { die("Query to show fields from table failed:".mysql_error()); } $i = 0; while($row = mysql_fetch_array($result)) { $sql = "SELECT * FROM $table WHERE topic_id = " . $row['submission_id']; $comments = mysql_query($sql) or die("Error ". mysql_error(). " with query ". $sql); $count = mysql_num_rows($comments); $num = mysql_num_rows($result); if(($i%2) == 0 ) $class = 'EVEN' : $class = 'ODD'; echo '<tr class='".$class."' >'; echo '<td class="forumtd"><strong>'; echo '<a href="topic.php?id='.$row['submission_id'].'">'.stripslashes(htmlspecialchars($row['col_1'])).'</a>'; echo "</strong></td>"; echo '<td class="forumtd"><em>'; echo stripslashes(htmlspecialchars($row['name'])); echo "</em></td>"; echo '<td class="forumtd">'; echo $count; echo "</td>"; echo '<td class="forumtd">'; echo date("l M dS, Y", $row['submission_date']); echo "</td>"; echo "</tr>"; $i++; } mysql_free_result($result); ?> Quote Link to comment Share on other sites More sharing options...
Lambneck Posted February 19, 2009 Author Share Posted February 19, 2009 :'( nope. now none of the echoed content shows up in the result. Quote Link to comment Share on other sites More sharing options...
allworknoplay Posted February 19, 2009 Share Posted February 19, 2009 Ok well use this code: I wanted you to use the cleaner code but just use this so you can be on your way... <?php $result = mysql_query("SELECT submission_id, col_1, name, submission_date FROM $table WHERE topic_id = '0' ORDER BY submission_id DESC"); if (!$result) { die("Query to show fields from table failed:".mysql_error()); } $i = 0; while($row = mysql_fetch_array($result)) { $sql = "SELECT * FROM $table WHERE topic_id = " . $row['submission_id']; $comments = mysql_query($sql) or die("Error ". mysql_error(). " with query ". $sql); $count = mysql_num_rows($comments); $num = mysql_num_rows($result); if(($i%2) == 0 ) { $class = 'EVEN'; }else{ $class = 'ODD'; } echo '<tr class='".$class."' >'; echo '<td class="forumtd"><strong>'; echo '<a href="topic.php?id='.$row['submission_id'].'">'.stripslashes(htmlspecialchars($row['col_1'])).'</a>'; echo "</strong></td>"; echo '<td class="forumtd"><em>'; echo stripslashes(htmlspecialchars($row['name'])); echo "</em></td>"; echo '<td class="forumtd">'; echo $count; echo "</td>"; echo '<td class="forumtd">'; echo date("l M dS, Y", $row['submission_date']); echo "</td>"; echo "</tr>"; $i++; } mysql_free_result($result); ?> Quote Link to comment Share on other sites More sharing options...
Lambneck Posted February 19, 2009 Author Share Posted February 19, 2009 Woohoo!! It works! thanks man, you really live up to your name! Quote Link to comment Share on other sites More sharing options...
allworknoplay Posted February 19, 2009 Share Posted February 19, 2009 Woohoo!! It works! thanks man, you really live up to your name! No problem, I would have rather had you use the cleaner code but it's really no biggie... I just wanted to get you on your way so you're not stuck on this all day.... 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.