• 0

[PHP/MYSQL] Count dates between two dates


Question

So I have this table of information available to me:

table.png

For example and what I would like to do is know how many rows there are between 1150561799 and 1150587001 and return a number eg 10.

It's been ages since I tried doing this stuff but the following isn't working for me :(

$query=query_first('SELECT count(*) FROM eqdkp_raids WHERE raid_date BETWEEN 1150561799 AND 1150587001');
$result=mysql_query($query);
$num=mysql_numrows($result);

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0
<?php
$sql = 'SELECT COUNT(*) AS count FROM table WHERE a > 12345 AND a < 12345;';
$res = mysql_query($sql);
$row = mysql_fetch_assoc($res);
echo $row['count'] . ' rows found';

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.