Jump to content

Fatal error: Cannot use object of type FX_Error as array


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

Recommended Posts

Im trying to create a link from one page to another that passes a Member ID value as follows:

http://acwa2djszbbyvu.devcloud.acquia-sites.com/Pages/acwaBoardBallotPaper2015.php?username=100000

But Im getting: Fatal error: Cannot use object of type FX_Error as array in /mnt/gfs/acwa2djszbbyvu/sites/default/files/subsites/Pages/acwaBoardBallotPaper2015.php on line 47

The PHP in the destination page is as follows:

<?php

//session_start();

include_once('FX/FX.php'); 
include_once('FX/server_data.php');

ini_set('display_errors', 1);
//var_dump($ballotData);
error_reporting(E_ALL);
//exit();
//ini_set('display_errors', 'On');
//print_r($errors);
//define('DEBUG', true);
//echo 'Hallo World';
//print_r($_POST);

/*
 * cb_checked
 * Checks to see if the value validates against a previously checked option
 *
 * @param string $value
 * @return boolean
 */
function cb_checked($value)
{
    $return = (false !== strpos(strtolower($value), 'Yes')) ? ' checked="checked"' : '';
    return $return;
}
function rb_checked($value, $check)
{
    $return = (false !== strpos(strtolower($value), $check)) ? ' checked="checked"' : '';
    return $return;
}

$username = $_REQUEST['username'];

$groupSize='1';

$ballot=new FX($serverIP, $webCompanionPort, $dataSourceType);
$ballot->SetDBData('Membership_on_Web','Voting_Online');
$ballot->SetDBPassword('$webPW','$webUN');

$ballot->AddDBParam('Member_ID', $username, 'eq');

$ballotResult=$ballot->FMFind(); 
$returnedCount=$ballotResult['foundCount'];    //THIS IS LINE 47
echo $ballotResult['errorCode']; 
foreach($ballotResult['data'] as $key=>$ballotData);
$ballotData = current($ballotResult['data']);

if($returnedCount != 1){
    exit("Membership could not be validated.\n");    
}

$searchVariable=explode('.',$key); 
$currentRecord=$searchVariable[0];

 

//etc.

?>
What am I doing wrong? I know passing values in URLs is not best practice but I just want to get the page to load any old how per the time being.

Link to comment
Share on other sites

Straight after the FMFind, insert the following to check what the underlying error is:

		if (FX::isError($ballotResult)) {
			echo $ballotResult->getMessage();
			echo "<br />";
			var_dump($ballotResult);
		}

 

Link to comment
Share on other sites

This topic is 2855 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.