Hello,
I've been trying to find a way to update one field based on the entries in two others.
I have four fields. In order they are: weekendDate, weekendLocation, weekendDetails, weekendDescr
I have a php function that I know works based on the information already in the table. What I want to do is to break down the weekendDate (yyyy-mm-dd) into the elements of an entire weekend.
For example: If the weekendDate is 2006-09-15, then the breakdown is Sep 15-17, 2006.
I then want to append the weekendLocation field within brackets. The end result looks something like:
Sep 15-17, 2006 [ Location goes here ]
The php function I want to use is:
$weekendDate=$values["Field1"];
$weekendLocation=$values["Field2"];
/output date/
$pieces = explode("-", $weekendDate);
$date_a=mktime(0,0,0,$pieces[1],$pieces[2],$pieces[0]);
$date_b=mktime(0,0,0,$pieces[1],$pieces[2]+2,$pieces[0]);
$date_a_out=date("M-j-Y",$date_a);
$date_bout=date("M-j-Y",$date<img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=3410&image=1&table=forumtopics' class='bbc_emoticon' alt='B)' />;
$pieces_a = explode("-", $date_a_out);
$pieces_b = explode("-", $date_b_out);
if($pieces_a[0]==$pieces_b[0]&&$pieces_a[2]==$pieces_b[2]){
$output_date=$pieces_a[0]." ".$pieces_a[1]."-".$pieces_b[1].", ".$pieces_a[2];
}elseif($pieces_a[0]!=$pieces_b[0]&&$pieces_a[2]==$pieces_b[2]){
$output_date=$pieces_a[0]." ".$pieces_a[1]."-".$pieces_b[0]." ".$pieces_b[1].", ".$pieces_a[2];
}elseif($pieces_a[0]!=$pieces_b[0]&&$pieces_a[2]!=$pieces_b[2]){
$output_date=$pieces_a[0]." ".$pieces_a[1].", ".$pieces_a[2]."-".$pieces_b[0]." ".$pieces_b[1].", ".$pieces_b[2];
}
/***/
$values["Field4"]=$output_date . " [ " . $weekendLocation . " ]";
However, I continue to get errors on execution. The latest error is "Undefined offset: 1"
Any help and/or guidance would be greatly appreciated.