Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Wednesday, November 11, 2026
About Us
Magazine
Open Source
CVS
Services
Index  »  Projects  »  phpMyEdit  »  Forum  »  How to calculate&display information based on date?

phpMyEdit General     How to calculate&display information based on date?
Post new topic   Reply to topic    
 
ned@kelly.org.au     Joined: 08 Apr 2004   Posts: 22   Location: Mosquito Flat, Australia
Post Posted: 2004-04-08 05:26
Back to top  Reply with quote     

First I would like to say that phpMyEdit totally kicks ass, I was able to create functionally apps for the company I work for in hours instead of days,

I have the below fields in my database and want to add an additional field.

Event_ID, Event, Date_due,

How do I add a column that calculates and display the number of days utill/from the Date_due field, I sure this is simple but I just dont know how to do it.

Thanks in advance for any help

Cheers

Ned

 
ajh     Joined: 17 Dec 2003   Posts: 236  
Post Posted: 2004-04-08 09:32
Back to top  Reply with quote     

You need to use the 'sql' function in PME. This allows you to apply an arbitrary MySQL expression and use the result as your column (effectively it creates an expression in the SELECT statement. Have a look at the MySQL documentation for date/time functions - you should be able to work out you need to put in the 'sql' expression.

HINT: it'll be something like:
...['sql'] = 'DATEDIFF(CURDATE(), <datefield>)'

 
ned@kelly.org.au     Joined: 08 Apr 2004   Posts: 22   Location: Mosquito Flat, Australia
Post Posted: 2004-04-16 04:22
Back to top  Reply with quote     

Thanks ajh

the sql command worked perfect

Code:

$opts['fdd']['DATEDIFF'] = array(
  'name'     => 'Date diff',
  'select'   => 'T',
  'maxlen'   => 14,
  'options'  => L,
  'sql'    => 'Date_due - CURDATE()',
  'sort'     => true
);

Cheers

Ned

 
MG     Joined: 28 Jun 2006   Posts: 5  
Post Posted: 2006-06-28 07:43
Back to top  Reply with quote     

Did you manage to get this working back to the database?

I'm struggling with the usage if sqlw when I have two virtual fields which I need to combine to update another database field.

I though you might have worked this one out.

 
Post new topic   Reply to topic    

Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top · Feedback form · Application form
Report bug on PLATON.SK website · Terms of use · Privacy policy