[FX.php List] Memories....MORE
Jonathan Schwartz
jschwartz at exit445.com
Thu May 13 06:36:12 MDT 2010
Interesting.
I was able to get the function to run, but only once per page. Otherwise:
Fatal error: Call to a member function
newAddCommand() on a non-object in
C:\Inetpub\wwwroot\SSL\functions.inc.php on line
12
where line 12 = $log_add = $log->newAddCommand('web');
I'm sure the answer is obvious...but not to me. ;-)
Jonathan
At 12:12 PM +0200 5/13/10, Gjermund Gusland Thorsen wrote:
>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
>>
>_______________________________________________
>FX.php_List mailing list
>FX.php_List at mail.iviking.org
>http://www.iviking.org/mailman/listinfo/fx.php_list
--
Jonathan Schwartz
Exit 445 Group
jonathan at exit445.com
http://www.exit445.com
415-370-5011
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.iviking.org/pipermail/fx.php_list/attachments/20100513/722f0324/attachment-0001.html
More information about the FX.php_List
mailing list