I will lost my job if i cannot solve this

php India
  • 13 years ago

    mysql_query("SELECT * from dmg348_phonemd.calltable,dmg348_prosperdoc.doctors where MONTHNAME(startcall)='$month' AND dmg348_phonemd.calltable.doctorID=dmg348_prosperdoc.doctors.docID");

     

    this is my query

    on displaying the $row['callcharge'] . it displays the 00:30:00.

    But i need in the format like 30 min & 00s

    then what is the query for that

     

  • 13 years ago

    Hi,

     

    Sorry my friend I don't use Mysql so I wrote the SQL using MSSQL and Access hoping that you or one of the forum members can translate it:

    Access:

    SELECT Left(Format([time],"hh:nn:ss"),2) & " hrs & " & Mid(Format([time],"hh:nn:ss"),4,2) & " mins & " & Right(Format([time],"hh:nn:ss"),2) & " sec" AS RTime FROM Table1

    MS Sql:

    SELECT LEFT(CONVERT(varchar, TransactionDate, 8), 2) + ' hrs & ' + SUBSTRING(CONVERT(varchar, TransactionDate, 8), 4, 2) + ' mins & ' + RIGHT(CONVERT(varchar, TransactionDate, 8), 2) + ' sec' AS RTime FROM Table1

     

    Hope this works for you.

     

     

     

    It is never about the number of languages you know, you either have the logic of programming or you don't.

  • 13 years ago

    how is that value stored in the database? is it stored just like that as a variable, or as a timestamp or something?

    if it's just like that as a variable, then just use PHP's string functions to chop it up how you like. or if it's a timestamp then PHP's time and date functions will come in handy. head over to the official site at www.php.net for all the info you'd ever want Smiley Face [:)]

    (by the way mate, it's "I will lose" not "I will lost" Big Smile [:D])

    Good luck! :)

  • 13 years ago

    Thanks But i find the solution

    $result1=mysql_query("SELECT MINUTE(tcalltime)as y,SECOND(tcalltime)as z  from dmg348_phonemd.calltable,dmg348_prosperdoc.doctors where MONTHNAME(startcall)='$m' AND dmg348_phonemd.calltable.doctorID=dmg348_prosperdoc.doctors.docID");

     

     

     

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“We better hurry up and start coding, there are going to be a lot of bugs to fix.”