ceil function

Questionsceil function
Qasim Khan asked 4 years ago

Hi,
i am using $col["name"] to get table data (call duration in seconds). i trying to use
$col["name"] = "call_duration";
$col["name"] = ceil($col["name"]/60);
function in order to round the the seconds to minutes. but it is not getting records in grid. Thanks.

4 Answers
Abu Ghufran answered 4 years ago

You can do such conversion in sql query.

e.g.
$g->select_command = "select …. ceil(call_duration/60) as call_duration, … from table";

Qasim Khan answered 4 years ago

can we use sql query with $col["name"]. because when i use

$g->select_command = "select ceil(call_duration/60) as call_duration from table";

it does conversion but there are no records in table except call_duration.

Abu Ghufran answered 4 years ago

You should select all fields that you want to display in sql query.
$g->select_command = "select f1,f2,f3,…..,ceil(call_duration/60) as call_duration from table";

Qasim Khan answered 4 years ago

Thanks.

Your Answer

11 + 18 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating / 5. Vote count:

We are sorry that this post was not useful for you!

Let us improve this post!