[FX.php List] Memories....MORE
Gjermund Gusland Thorsen
ggt667 at gmail.com
Thu May 13 04:12:20 MDT 2010
function? you want to turn the query into a function?
function LogMyStuff( $arrayOfVariables, $_SESSION ){
require_once('Connections/log_prefs.php');
require_once('FileMaker.php');
$log_add = $log->newAddCommand('web');
$log_add_fields = array(
'DB'=>'ABCD',
'IP'=> $IP,
'Browser'=> $AGENT,
'hostname'=> $_SESSION['hostname'],
'sessionid'=> $sessionid,
'Location'=> $_SERVER['PHP_SELF'],
'Step'=>$arrayOfVariables['Step'],
'Detail'=> $arrayOfVariables[' Detail,
'Name'=> $arrayOfVariables[' Name,
'ZipCode'=>$arrayOfVariables[' Zip,
'Route'=>$arrayOfVariables[' Route,
'Message'=>$arrayOfVariables[' Message,
'mode'=>$_SESSION['loginmode'],
'type'=>$_SESSION['type'],
'elapsed'=>$arrayOfVariables[' timeelapsed,
'CustID'=>$_SESSION['Customer_ID_Number'],
'Rep'=>$_SESSION['LastName'],
'users'=>$_SESSION['OnlineUsers'],
'Region'=>$_SESSION['Region'],
'referer'=>$arrayOfVariables[' referer,
'CustTempRecID'=>$TempRecID
);
foreach($log_add_fields as $key=>$value)
{
$log_add->setField($key,$value);
}
$log_add_results= $log_add->execute();
if(FileMaker::isError($log_add_results))
{
$error_code = $log_add_results->code;
exit;
}else{
$log_row =
current($log_add_results->getRecords());
}
};
or maybe
change it to something like:
function LogMyStuff( $_POST, $_GET, $_SESSION ){
require_once('Connections/log_prefs.php');
require_once('FileMaker.php');
$log_add = $log->newAddCommand('web');
$log_add_fields = array(
'DB'=>'ABCD',
'IP'=> $IP,
'Browser'=> $AGENT,
'hostname'=> $_SESSION['hostname'],
'sessionid'=> $sessionid,
'Location'=> $_SERVER['PHP_SELF'],
'Step'=>$_POST['Step'],
'Detail'=> $_POST[' Detail,
'Name'=> $_POST[' Name,
'ZipCode'=>$_POST[' Zip,
'Route'=>$_POST[' Route,
'Message'=>$_POST[' Message,
'mode'=>$_SESSION['loginmode'],
'type'=>$_SESSION['type'],
'elapsed'=>$_POST[' timeelapsed,
'CustID'=>$_SESSION['Customer_ID_Number'],
'Rep'=>$_SESSION['LastName'],
'users'=>$_SESSION['OnlineUsers'],
'Region'=>$_SESSION['Region'],
'referer'=>$_POST[' referer,
'CustTempRecID'=>$TempRecID
);
foreach($log_add_fields as $key=>$value)
{
$log_add->setField($key,$value);
}
$log_add_results= $log_add->execute();
if(FileMaker::isError($log_add_results))
{
$error_code = $log_add_results->code;
exit;
}else{
$log_row =
current($log_add_results->getRecords());
}
};
compliments of the array-cowboys™
ggt
2010/5/12 Jonathan Schwartz <jschwartz at exit445.com>:
> OK. How about a gentle push in the right direction? It's a big jump from
> example code to doing creating a function for an entire query, using a dozen
> or so variables.
>
> Here is my log.php query "add" code using the API. Do I need to define
> every variable in the function definition? What about the first two lines
> that contain includes?
>
>
> Existing Log Code:
> require_once('Connections/log_prefs.php');
> require_once('FileMaker.php');
> $log_add = $log->newAddCommand('web');
> $log_add_fields = array(
> 'DB'=>'ABCD',
> 'IP'=> $IP,
> 'Browser'=> $AGENT,
> 'hostname'=> $_SESSION['hostname'],
> 'sessionid'=> $sessionid,
> 'Location'=> $_SERVER['PHP_SELF'],
> 'Step'=>$Step,
> 'Detail'=> $Detail,
> 'Name'=> $Name,
> 'ZipCode'=>$Zip,
> 'Route'=>$Route,
> 'Message'=>$Message,
> 'mode'=>$_SESSION['loginmode'],
> 'type'=>$_SESSION['type'],
> 'elapsed'=>$timeelapsed,
> 'CustID'=>$_SESSION['Customer_ID_Number'],
> 'Rep'=>$_SESSION['LastName'],
> 'users'=>$_SESSION['OnlineUsers'],
> 'Region'=>$_SESSION['Region'],
> 'referer'=>$referer,
> 'CustTempRecID'=>$TempRecID
> );
>
> foreach($log_add_fields as $key=>$value)
> {
> $log_add->setField($key,$value);
> }
> $log_add_results= $log_add->execute();
>
> if(FileMaker::isError($log_add_results))
> {
> $error_code = $log_add_results->code;
> exit;
> }else{
> $log_row =
> current($log_add_results->getRecords());
> }
>
>
> Thanks for the help.
>
> Jonathan
>
>
> --
> Jonathan Schwartz
> Exit 445 Group
> jonathan at exit445.com
> http://www.exit445.com
> 415-370-5011
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
More information about the FX.php_List
mailing list