T
|
thesofa 9/10/2006 |
do you want the new value to be 7 days after the date that was in the field? |
J
|
Jean author 9/10/2006 |
do you want the new value to be 7 days after the date that was in the field? Or do you want this value suggested for the firld and you can alter it if you want?
|
T
|
thesofa 9/10/2006 |
which flavour of database are we talking here? |
J
|
Jean author 9/10/2006 |
which flavour of database are we talking here?
|
T
|
thesofa 9/10/2006 |
Sorry to be clumsy. A simple mysql with just one table. Adding a new record, the user have to indicate a date. Generally, this date is the last date recorded in the previous record + one week. I would like to suggest him this date, letting him change if desired. Does it help ?
Editing a date field, I would like that the default date value were calculated from the previous datefield recorded
|
J
|
Jean author 9/10/2006 |
now that is a bit different from the first post. you said originally this is different from the adding a new record. Are we editing an existing record or adding a new record in the database? There is quite a big difference <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=10985&image=1&table=forumreplies' class='bbc_emoticon' alt=':D' />
|
T
|
thesofa 9/10/2006 |
Adding <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=10986&image=1&table=forumreplies' class='bbc_emoticon' alt=';)' />
|
J
|
Jean author 9/10/2006 |
so the process will be find last record get date value from last record add 7 days to it make it as default value for editable field in add_form If you break it down like this, you can search the forum for each action you need to do and find posts that will help you solve it. If you need more help, just keep posting <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=10987&image=1&table=forumreplies' class='bbc_emoticon' alt=':D' />
|
T
|
thesofa 9/10/2006 |
It becomes more clear, thanks. "find last record" or "last record" give no result in the forum. Not a good beginning. I'll try later.
|
J
|
Jean author 9/10/2006 |
OK, have a look here and see if you can adapt the code to fit your case. He is looking for the last ID number entered. I assume you are using an ID field set to autoincrement as aprimary key? If you find the last record like that, you can then extract the date field from it an assign it to a variable. Once you have this in a variable, you can add 7 days to it using date_add HTH
|
J
|
Jane 9/11/2006 |
Jean, global $conn; $rs = mysql_query("select max(date_init) from _PermanencesTableau",$conn); $data = mysql_fetch_array($rs, MYSQL_NUM); $_SESSION["max"] = $data[0];
|
J
|
Jean author 9/11/2006 |
Jean, use $_SESSION variables to pass value from event to other pages. And then use $_SESSION["max"] as default value on the Formatting tab.
|