php - having trouble filtering out multiple rows if a specific criteria is met -
edit: issue resolved give thanks you!
i'm having problem figuring out method omit both entries (time , message_time) echo'd table in row, if value $row['time']; returned 0.
<?php date_default_timezone_set('america/new_york'); // start session management $user->session_begin(); $auth->acl($user->data); $user->setup(); include($phpbb_root_path.'config.'.$phpex); mysql_connect("$dbhost", "$dbuser", "$dbpasswd") or die(mysql_error()); mysql_select_db("$dbname") or die(mysql_error()); // info "example" table $result = mysql_query("select * phpbb_mchat user_id = '$userid' order message_time desc") or die(mysql_error()); echo "<table class='sortable'>"; echo "<tr> <th>saved on</th> <th>time (mm:ss)</th> </tr>"; // keeps getting next row until there no more while($row = mysql_fetch_array( $result )) { // print out contents of each row table if ($row['time'] != "0") { echo "<tr><td>"; echo $row['message_time'] = date( "f j, y, g:ia", $row['message_time']); echo "</td><td>"; echo $row['time']; echo "</td></tr>"; } } echo "</table>"; ?>
assuming trying omit rows in table "time" 0
while($row = mysql_fetch_array( $result )) { // print out contents of each row table if ($row['time'] != "0") { echo "<tr><td>"; echo $row['message_time'] = date( "f j, y, g:ia", $row['message_time']); echo "</td><td>"; echo $row['time']; echo "</td></tr>"; } } the entire row omited if $row['time'] 0
php
No comments:
Post a Comment