Himitsu Posted October 4, 2007 Posted October 4, 2007 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.
Himitsu Posted October 5, 2007 Author Posted October 5, 2007 Ok.. I got it.. kind of.. but how do you format the $date to convert into a filemaker useable format?
Genx Posted October 5, 2007 Posted October 5, 2007 $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.
Himitsu Posted October 5, 2007 Author Posted October 5, 2007 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?
Genx Posted October 5, 2007 Posted October 5, 2007 FileMaker doesn't accept YYYY/mm/dd format, it accepts mm/dd/YYYY
Himitsu Posted October 5, 2007 Author Posted October 5, 2007 oh, sorry... I thought it was how it was displayed... got it.
Himitsu Posted October 5, 2007 Author Posted October 5, 2007 but, just curious though, how would you add 57600 seconds to "date('m/d/Y H:i:s');"? to compensate for server time.
Himitsu Posted October 5, 2007 Author Posted October 5, 2007 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.
Genx Posted October 5, 2007 Posted October 5, 2007 No worries, but just so you know, those two statements are exactly the same.
Recommended Posts
This topic is 6521 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now