October 4, 200718 yr I have a reservation system in php and it works fine up until I get into the date areas. So, I figured that what I could do is when the student logs in, it would setfield with current timestamp. I gave a couple wacks at it but it is getting jumbled up. Could someone see where I went wrong? <?php session_start(); include_once('FX/FX.php'); include_once('FX/server_data.php'); $userid=$_POST['userid']; $password = $_POST['password']; $DateTimestamp = date("m/d/y",timestamp); // UPDATE THE TIMESTAMP FIELD currentTimeStamp_g WITH CURENT TIMESTAMP $edit=new FX($serverIP,$webCompanionPort); $edit->SetDBData($dbname,'students'); $edit->SetDBPassword($pw,$un); $edit->AddDBParam('kp_student_id',$userid); $edit->AddDBParam('currentTimeStamp_g',$DateTimestamp); $editResult=$edit->FMEdit(); $find=new FX($serverIP,$webCompanionPort); $find->SetDBData($dbname,'students',1); $find->SetDBPassword($pw,$un); $find->AddDBParam('kp_student_id','=='.$userid); $find->AddDBParam('password','=='.$password); $findResult=$find->FMFind(); if ($findResult['errorCode']==0){ foreach($findResult['data'] as $key=>$findData); $_SESSION['studentid'] = $findData['kp_student_id'][0]; $_SESSION['registrations_available'] = $findData['registrations_available'][0]; $_SESSION['name'] = $findData['name'][0]; include_once("course_list.php"); }else{ //include_once('login_error.htm'); } ?> There is a log in page that collects the userid and pass. Any help would be great.
October 5, 200718 yr Author Ok.. I got it.. kind of.. but how do you format the $date to convert into a filemaker useable format?
October 5, 200718 yr $DateTimestamp = date("m/d/y",timestamp); Try this instead: $DateTimestamp = date("m/d/Y"); Filemaker simply expects a mm/dd/yyyy date format, though it may be happy with m/d/yy, i've never tried it like that.
October 5, 200718 yr Author I got it by using this: $DateTimestamp = date('Y/m/d H:i:s'); but it opened another can of worms. If the field it is going into is a text field, then it is ok. But if the field is a timestamp then it won't add it and gives a php error code 501. I also tried to take two fields, time and date and make a calc with the result being timestamp. That didn't work either... any ideas? or what is the technique to write from php to a timestamp field?
October 5, 200718 yr Author but, just curious though, how would you add 57600 seconds to "date('m/d/Y H:i:s');"? to compensate for server time.
October 5, 200718 yr Author I ended up doing this $now = time(); $newtime = $now+57600; $Timestamp = date("m/d/Y H:i:s", $newtime); Thanks a lot for your time. It really pointed me in the right direction.
Create an account or sign in to comment