0

I am having problem to the footable because whenever i use the data-format-string in footable the output becomes the same.

 <table id="table" data-paging="true" data-sorting="true">
 <thead>
      <tr>
         <th data-name="date_from" data-type="date" data-format-string="MMM DD YYYY">Date</th>
         <th data-name="title">Title</th>
         <th data-name="venue">Venue</th>
        <th data-name="activity_id">View</th>
     </tr>
     </thead>
      <tbody>
        <?php
           $myqry=$db->prepare("SELECT activity_id,date_from,title,venue FROM activity" );
           $myqry->execute();
           $anotherarray=array();
           while($myqr=$myqry->fetch(PDO::FETCH_ASSOC)){
                 echo '<tr><td>'.$myqr['date_from'].'</td>
                 <td>'.$myqr['title'].'</td>
                 <td>'.$myqr['venue'].'</td>
                 <td><a href="view_act.php?actvid='.$myqr['activity_id'].'">View</a></td></tr>';
           }                              
       ?>
 </tbody>
 </table>

What I expect:

this is i expect to see in my date column

What I get:

this is what i get

4
  • Welcome! You might want to include images that are mostly text as just text in the body of your post. Failing that, add an exclamation point in front of each of 'em ![description][1] to make it easier for people to answer your question. Cheers! Commented Dec 9, 2017 at 1:41
  • oh okay, im just new here, thanks for the suggestion . however i cant post images due to the lack of reputation Commented Dec 9, 2017 at 1:50
  • Ah, I see. I should be able to make it inline by editing :) Commented Dec 9, 2017 at 1:53
  • 1
    Wow! we can do that huh? Thank you :) Commented Dec 9, 2017 at 2:00

1 Answer 1

1

Solved this question. I converted my date using strtotime then multiplied it by 1 milliseconds. My reference was Pass Datetime/Timestamp from PHP to Javascript by echo the one that Travesty3 answered. This is my php code now

<?php
    $myqry=$db->prepare("SELECT activity_id,date_from,title,venue FROM activity" );
    $myqry->execute();
    while($myqr=$myqry->fetch(PDO::FETCH_ASSOC)){
      $mydate=strtotime($myqr['date_from'])*1000;
      echo '<tr><td data-value="'.$mydate.'"></td>
          <td>'.$myqr['title'].'</td>
          <td>'.$myqr['venue'].'</td>
          <td><a href="proc_view_act.php?actvid='.$myqr['activity_id'].'">View</a></td></tr>';
    }                            

?>

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.