sashavalentina Posted September 6, 2021 Share Posted September 6, 2021 I'm creating a dynamic tabs with dynamic content by using Bootstrap in PHP Mysql. what i want to do here is, i display the order_date on the nav-tab and the content of each nav-tab will be display by the date of the customer made their orders. But i can't figure out why my nav-tab with dates are showing, but my content isn't showing, i've checked my database, there is no problem in there. I need help from you all, any form of help will be appreciated. thanks! <?php $date_sql = "SELECT id,cast(order_datetime as date) AS ordered_date , order_status FROM ordered_items GROUP BY ordered_date order by order_datetime DESC LIMIT 7"; $resultset = mysqli_query($conn, $date_sql) or die("database error:". mysqli_error($conn)); $order_status = 0 ; $nav_tab_html = ''; $ordered_items_html = ''; while( $nav_tab = mysqli_fetch_assoc($resultset) ) { $current_tab = ""; $current_content = ""; $nav_tab_html.= '<li class="'.$current_tab.'"><a class="nav-link" href="#'.$nav_tab['ordered_date'].'" data-toggle="tab">'. $nav_tab['ordered_date'].'</a></li>'; $ordered_items_html .= '<div id="'.$nav_tab["ordered_date"].'" class="tab-pane fade '.$current_content.'">'; $ordered_tab_sql = "SELECT*, cast(order_datetime as date) AS products_ordered_date , order_status FROM ordered_items LEFT JOIN products ON ordered_items.product_id = products.id WHERE order_datetime = '".$nav_tab["ordered_date"]."'"; $ordered_tab_results = mysqli_query($conn, $ordered_tab_sql) or die("database error:". mysqli_error($conn)); if(!mysqli_num_rows($ordered_tab_results)) { $ordered_items_html .= '<br>No order found!'; } while($ordered_item_tab = mysqli_fetch_assoc($ordered_tab_results) ) { $ordered_items_html .= '<div class="col-md-3 product">'; $ordered_items_html .= '<img src="https://mywebsite/images/'.$ordered_item_tab["product_photo"].'" class="img-responsive img-thumbnail product_image" />'; $ordered_items_html .= '</div>'; } $ordered_items_html .= '<div class="clear_both"></div></div>'; } ?> <div class="col-12"> <div class="card"> <div class="card-header"> <h4 class="card-title"> All Products</h4> <span> <a href="download-list/download-products.php" class="btn btn-info float-right mb-3"><i class="fa fa-download" aria-hidden="true"></i> Download Products List</a> </span> <span> <a href="download-list/download-products.php" class="btn btn-info float-right mb-3"><i class="fa fa-download" aria-hidden="true"></i> Download Products List</a> </span> </div> <div class="card-body"> <ul class="nav nav-tabs"> <li class="nav-item"> <ul class="nav nav-tabs"> <?php echo $nav_tab_html; ?> </ul> </li> </ul> </div> <div class="tab-content"> <?php echo $ordered_items_html; ?> </div> </div> Quote Link to comment https://forums.phpfreaks.com/topic/313670-dynamic-nav-content-does-not-display/ Share on other sites More sharing options...
gw1500se Posted September 6, 2021 Share Posted September 6, 2021 Post the resulting raw HTML source. Quote Link to comment https://forums.phpfreaks.com/topic/313670-dynamic-nav-content-does-not-display/#findComment-1589689 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.