这是我的脚本,如果数据库中 categories="" 的值,我想跳过循环。我怎么能那样做??
public function display_international( ) {
$query = 'SELECT *
FROM
tourDB
WHERE
tour_type = "international"';
$result = mysql_query( $query ) or die( mysql_error() );
if ( $result !== false && mysql_num_rows( $result ) > 0 ) {
while ( $i = mysql_fetch_assoc( $result ) ) {
$international_cats = stripslashes( $i[ 'categories' ] );
$international_display .= <<<PANEL_DISPLAY
<a class="international-tour-box-element" href=# >$international_cats</a>
PANEL_DISPLAY;
} //$b = mysql_fetch_assoc( $result )
} //$result !== false && mysql_num_rows( $result ) > 0
else {
$international_display = <<<PANEL_DISPLAY
<a class="international-tour-box-element" href="#" >No tours !</a>
PANEL_DISPLAY;
}
return $international_display;
}