Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

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

Recommended Posts

Posted

Hi there,

I have an order form which gets its products from a FMPro DB including the price of each item. When a customer enters a Quantity, and clicks an Update Order button the form is supposed to create a subtotal of all orders. However I gettting this eror message:

Fatal error: Unsupported operand types in /Library/WebServer/Documents/order_publications.php on line 94

Here is the code:

<?php

include_once('FX/FX.php');

include_once('FX/server_data.php');

$publications=$_REQUEST['publication'];

if(isset($_GET['skip'])){ $skipSize=$_GET['skip'];}else{$skipSize='0';}

$groupSize='50';

$Pub_Search=new FX($serverIP,$webCompanionPort,'FMPro7');

$Pub_Search->SetDBData('Publications.fp7','Publications',$groupSize);

$Pub_Search->SetDBPassword('fmsadmin','fmsadmin');

$Pub_Search->AddDBParam('Availability','AVAILABLE');

$Pub_Search->AddSortParam('Name_of_Publication','ascend');

$Pub_Search->FMSkipRecords($skipSize);

$Pub_SearchResult=$Pub_Search->FMFind();

$returnedCount=$Pub_SearchResult['foundCount'];

echo $Pub_SearchResult['errorCode'];

foreach($Pub_SearchResult['data'] as $key=>$Pub_SearchData);

$searchVariable=explode('.',$key);

$currentRecord=$searchVariable[0];

?>

/rest of web page

<?php

$total=0;

foreach($Pub_SearchResult['data'] as $key=>$Pub_SearchData){ ?>

<? echo $Pub_SearchData['Name_of_Publication'][0]; ?>

<?php echo $Pub_SearchData['Price'][0]; ?>

<?php echo (isset($_POST['quantity'])? $_POST['quantity'] ;) 0) * $Pub_SearchData['Price']; $total += (isset($_POST['quantity']) ? $_POST['quantity'] : 0) * $Pub_SearchData['Price']; ?>

<? } ?><?php echo $total; ?>

Posted

Steven,

Can you let us know what exactly is on line 94?

In fact give us line 93, 94 and 95

from your code

echo $Pub_SearchResult['errorC ode'];

foreach($Pub_SearchResult ['data'] as $key=>$Pub_SearchData) ;

you have a some odd spaces in your code in this messsage . Is this a property of the forums or your actual code?

you have two foreach statements. One that has an extra semi colon and then tries to reference the record ID but it is not in the loop for the records.

Posted

Site Navigation

var mmfolder=/*URL*/"menumachine/",zidx=1000;

//null

left%20menu%20bar.jpg

Order Publications

Site Navigation

var mmfolder=/*URL*/"menumachine/",zidx=1000;

//null

Banner.jpgLime%20Banner.jpg

blue.jpg

Name of Publication

LINE 99

Price

Qantity

Sub-Total

<?php

$total=0;

foreach($Pub_SearchResult['data'] as $key=>$Pub_SearchData){ ?>

<? echo $Pub_SearchData['Name_of_Publication'][0]; ?>

<?php echo $Pub_SearchData['Price'][0]; ?>

<?php echo (isset($_POST['quantity'])? (int)$_POST['quantity'] ;) 0)

LINE 123 * $Pub_SearchData['Price']; ?>

<? } ?>

<?php echo $total; ?>

Posted

Hi zippy,

Well on line 99 you have a stray ;

line 123 does not start with <?php and is not correctly formed.

LINE 123 * $Pub_SearchData['Price']; ?>

should maybe read <?php echo $Pub_SearchData['Price'][0]; ?>

Note the addition of the [0] and also the fact it is echo'd out.

The error you get is usually due to a value not being numeric.

Let us know if this helps at all.

Posted

Hi Andy,

The line 123 code is part of the <?php ?> tags from the preceding line - I just put "LINE 123" in to show you where the troublesome code is. The code is actually:

<?php echo (isset($_POST['quantity'] )? (int)$_POST['quantity'] ;) 0) * $Pub_SearchData['Price']; ?>

Cheers,

Steven

Posted

Steven,

Did you remove the extra ; from line 99 as that is where your error message is.

Also just noticed on line 98 you have two font references instead of just one.

font FONT size="2"

Posted

Site Navigation

var mmfolder=/*URL*/"menumachine/",zidx=1000;

//null

left%20menu%20bar.jpg

Order Publications

Site Navigation

var mmfolder=/*URL*/"menumachine/",zidx=1000;

//null

Banner.jpgLime%20Banner.jpg

blue.jpg

Name of Publication

Price

Qantity

Sub-Total

<?php

$total=0;

foreach($Pub_SearchResult['data'] as $key=>$Pub_SearchData){ ?>

<? echo $Pub_SearchData['Name_of_Publication'][0]; ?>

<?php echo $Pub_SearchData['Price'][0]; ?>

<?php echo (isset($_POST['quantity_' . $Pub_SearchData['Record_Number']])? $_POST['quantity_' . $Pub_SearchData['Record_Number']] ??? 0) * $Pub_SearchData['Price']; $total += (isset($_POST['quantity_' . $Pub_SearchData['Record_Number']]) ? $_POST['quantity_' . $Pub_SearchData['Record_Number']] : 0) * $Pub_SearchData['Price']; ?>

<? } ?>

<?php echo $total; ?>

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