| Index
» Projekty
» phpMyEdit
» Fórum
» How to calculate&display information based on date? |
 |
ned@kelly.org.au
Založený: 08.04.2004
Príspevky: 22
Bydlisko: Mosquito Flat, Australia
Zaslal: 2004-04-08 05:26
Návrat hore
Odpovedať s citátom
|
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
Založený: 17.12.2003
Príspevky: 236
Zaslal: 2004-04-08 09:32
Návrat hore
Odpovedať s citátom
|
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
Založený: 08.04.2004
Príspevky: 22
Bydlisko: Mosquito Flat, Australia
Zaslal: 2004-04-16 04:22
Návrat hore
Odpovedať s citátom
|
Thanks ajh
the sql command worked perfect
| Kód: |
$opts['fdd']['DATEDIFF'] = array(
'name' => 'Date diff',
'select' => 'T',
'maxlen' => 14,
'options' => L,
'sql' => 'Date_due - CURDATE()',
'sort' => true
);
|
Cheers
Ned
|
MG
Založený: 28.06.2006
Príspevky: 5
Zaslal: 2006-06-28 07:43
Návrat hore
Odpovedať s citátom
|
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.
|
|
Odoslať novú tému
Odpovedať na tému
|
|
|
|