Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Simple Shopping Cart Form

Featured Replies

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; ?>

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.

  • Author

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; ?>

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.

  • Author

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

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"

  • Author

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; ?>

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.