This topic is locked

math operations with fields

7/3/2008 10:11:35 AM
PHPRunner General questions
W
webimmagine author

hi,
plz can someone help me on this :
how can i do a math operations as - or + with 2 fields , i saw on the forum that i must create a new variable but i don t know how, i tried but ... <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=8911&image=1&table=forumtopics' class='bbc_emoticon' alt=':huh:' />
so i have 2 fields in the visual editor its like {build_edit_control field="start_time" mode="add" value=$value_start_time} and

{build_edit_control field="end_time" mode="add" value=$value_end_time} the result of $value_start_time - $value_end_time
is shown in {build_edit_control field="duree" mode="add" value=$value_duree}
i m really sorry if it s look like easy for you guys but i really don t know how to do this , i create a new fields after building the project that worked fine but still don t work in the original fields.
thank u so much for your help

Sergey Kornilov admin 7/3/2008

Best guess - create a calculated field in SQL query i.e.

select start_time,

end_time.

end_time - start_time as diff

from ...



Depending on the field type you might need to use one of date functions provided by your database to calculate the difference.

W
webimmagine author 7/18/2008

thanks you guys always there for us, but still doesn t work for me i tried to have the sql fucntion directly in the custom codeno result,
i really don t know what can i do, i just wanna calcualte the difference between 2 fields, i tried to change it in the php code directly but cant use the smarty values
can somebody help please

J
Jane 7/21/2008

Hi,
you need to edit your SQL query on the Edit SQL query tab.

W
webimmagine author 7/22/2008

thanks
i m stupid i didn t think about that , i m gonna try it
thanks

W
webimmagine author 7/23/2008

works great thank you so much for your help i even don t add any value now on the add page after clicking on th submit bouton i got the fileds calculated on the table directly wich is very cool , i m gonna look on th forum now how can i get the last record added after adding a new data on the adding page and also how can i covert hh:mm:ss format to mm format ( minutes) <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=31345&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />

thanks you so much