Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6250 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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.

Posted

$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.

Posted

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?

Posted

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.

This topic is 6250 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.