Jump to content

Recommended Posts

I have a database like

Column Type Null Default Comments status_id int(15) No status_message text No attachment varchar(40) No post_on datetime No sent tinyint(1) No 2 1 = sent, 2 = not sent user_id int(15) No comp_id int(15) No social_network int(1) No 1 1 = Facebook, 2 = Twitter, 3 = Linkedin success tinyint(1)

 

my mysql select looks like

 

// Make the query:
$q = "SELECT status_id, status_message, attachment, DATE_FORMAT(post_on, '%M %d, %Y %H:%i') AS dr, sent, success FROM social_calendar WHERE comp_id = '{$_SESSION['comp_id']}' ORDER BY post_on DESC LIMIT $start, $display";
$r = @mysqli_query($dbc, $q); // Run the query.
$all_status = array();
while($row = mysqli_fetch_array($r, MYSQLI_ASSOC)){
   $all_status[] = $row;
}

 

what i want to be able to archive is the status grouped by day

 

<table class="table table-striped">
   <thead>
<tr>
<th>Image</th>
	    <th>Sent</th>
	    <th>Success</th>
<th>Status Message</th>
<th>Publish</th>
<th>Actions</th>
</tr>
</thead>
   <tbody>


  <?php foreach($all_status as $status){ ?>
   <tr>
<th colspan="6" style="text-align:center; background-color:#CBF09E">November 28, 2012</th>
   </tr>

  <?php $status_message = substr(strip_tags($status['status_message'], ''), 0, 44) . '...'; ?>

   <tr>
   <td>...</td>
   <td><?php echo ($status['sent'] == '1') ? '<i class="icon-ok" title="Successfully Sent"></i>' : '<i class="icon-time" title="Not Yet Posted"></i>' ?></td>
   <td><?php echo ($status['success'] == '1') ? '<i class="icon-ok" title="Successfully Posted"></i>' : '<i class="icon-remove" title="Failed To Post"></i>' ?></td>
   <td><?php echo $status_message; ?></td>
   <td><?php echo $status['dr']; ?></td>
   <td>
   <a data-keyboard="true" data-backdrop="true" class="btn small edit" href="#">Edit</a>
   <a class="btn btn-danger" data-keyboard="true" data-backdrop="true" href="<?php echo BASE_LOGGEDIN_URL . 'delete.php?item=3&id=' . $status['status_id'] . ''; ?>">Delete</a></td>
   </tr>

   <?php } ?>

   </tbody>
   </table>

Link to comment
https://forums.phpfreaks.com/topic/271241-group-by-day/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.