Log in

View Full Version : regarding subtime



anto
11-19-2009, 08:50 AM
Hello All,

I have a table with id(int),mobilenumber(varchar),time(datetime) as fields.
and it has lots of rows of data it's a database table for tollfree number.I am selecting the rows by giving from date and to date functions.

<?php
require_once './sessions.php';
require_once './classes/mysql_db.php';
require_once './classes/tf.php';
$db=new mysql_db();
$portal=new portal();
$connection=$db->db_connect();
$limit=10;
$from_date="";
$to_date="";

$extension="";
if(isset($_REQUEST['from_date']))
{
$from_date=$_REQUEST['from_date'];
}
if(isset($_REQUEST['to_date']))
{
$to_date=$_REQUEST['to_date'];
}
?>

function getUserTotalRecordedFiles($con,$extension,$from_date,$to_date,$from_h,$to_h)
{
$sql=new mysql_db();
$this->query="select date_format(time,'%b %d,%Y %H:%i:%s') as on_date,caller,duration,filename,count(caller) as noofcalls from tollfree where id!=''";
if(strlen(trim($from_date))>0)
{
$this->query.=" and date(time)>='$from_date'";
}
if(strlen(trim($to_date))>0)
{
$this->query.=" and date(time)<='$to_date'";
}

$this->query.=" group by id order by time desc";
$this->rs=$sql->query($this->query,$con);
return $this->rs;
}//function to select the data from database


Now my requirement is to select the data from last 1hour,2hr,3hr------last 24hour from the database table.I put the number of hours in drop down box(1,2,......24)
i.e if i select the number(1/2/3/4.../24)from drop down box the webpage displays only the data which is in between the current time to the number of hours which i have selected in the dropdown box.


please anybody help me to fix this problem,

It's very urgent to me....

Thanks in advance,

regards,
Anto.

anto
11-24-2009, 05:39 AM
Dear All,


Please anyone help me to solve my problem


Thanks and regards,
Anto