mercredi 28 novembre 2018

php If statement inside another php if statement [duplicate]

This question already has an answer here:

I want to display whole code if $ws_user_status is 1, but inside this i want to separate the code on 2 another if statements... if $ws_total_sales == 0 to display info message, else ($ws_total_sales > 0) to display the table with all content items

But i have something made wrong... the table is visible all the time...

<?php
$ws_total_sales == 3;
$ws_user_status == 1;
?>

<?php if ($ws_user_status == 1) : ?>
<?php if ($ws_total_sales == 0 ) : ?>
<div class="woocommerce-info">
    <?php _e( 'You do not have any items to sell.', 'woocommerce' ); ?>
</div>
<?php else : ?>
<div>
<div class="alert alert-info">
    <?php _e( 'Your sales.', 'woocommerce' ); ?>
</div>      
      <table class="table table-hover">
        <thead>
          <tr>
            <th>Item</th>
            <th>Total sale</th>
            <th>Your profit</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td>Item 1 name</td>
            <td>100</td>
            <td>75000</td>
          </tr>
          <tr>
            <td>Item 2 name</td>
            <td>100</td>
            <td>60000</td>
          </tr>
          <tr>
        </tbody>
      </table>
</div>  
<?php endif; ?>
<?php endif; ?>

Aucun commentaire:

Enregistrer un commentaire