close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Fatal Error: Function name must be a string

Thread began 8/25/2009 8:52 am by tom92909 | Last modified 9/15/2009 10:43 am by Jason Byrnes | 7991 views | 5 replies |

tom92909Beta Tester

Fatal Error: Function name must be a string

Good morning! :)

I've created a new shopping cart using the new 4.5 eCart Extension. I've had v4 working in the past with no issues, but this is a brand new cart using the the new version.

On order confirmation, I'm getting the following error message;
Fatal error: Function name must be a string in /public_html/confirm.php on line 306

Line 306

php:
$WA_fieldValuesStr = "".session_id()  ."" . "|" . "".((isset($_POST["email"]))?$_POST["email"]:"")  ."" . "|" . WA_eCDB_ConvertNumber("".$eCart1->GetShipping()  ."") . "|" . WA_eCDB_ConvertNumber("".$eCart1->GetTax()  ."") . "|" . WA_eCDB_ConvertNumber("".$eCart1->GrandTotal()  ."") . "|" . "".$date(m/d/Y)  ."" . "|" . "".((isset($_POST["firstname"]))?$_POST["firstname"]:"")  ." ".((isset($_POST["lastname"]))?$_POST["lastname"]:"")  ."" . "|" . "".((isset($_SERVER["REMOTE_ADDR"]))?$_SERVER["REMOTE_ADDR"]:"")  ."";




I have Dreamweaver CS3.
I am using Apache, Linux PHP, and MySQL.
I have probably 7 other domains with functional v4 carts (not v.4.5)

I am populating both Order and OrderDetail tables when the transaction is completed.

confirm.php - Lines 297 thur 357:

php:
<?php 

// WA eCart Store Cart Summary in Db
if (($_SERVER["REQUEST_METHOD"] == "POST") && (isset($_SERVER["HTTP_REFERER"]) && strpos(urldecode($_SERVER["HTTP_REFERER"]), urldecode($_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"])) > 0) && isset($_POST)) // Trigger
{
  
$WA_connection $ba;
  
$WA_table "orders";
  
$WA_redirectURL "";
  
$WA_indexField "OrderID";
  
$WA_fieldNamesStr "OrderReferenceID|OrderUserID|OrderShipping|OrderTax|OrderTotal|OrderDate|OrderUserName|ip_address";
  
$WA_fieldValuesStr "".session_id()  ."" "|" "".((isset($_POST["email"]))?$_POST["email"]:"")  ."" "|" WA_eCDB_ConvertNumber("".$eCart1->GetShipping()  ."") . "|" WA_eCDB_ConvertNumber("".$eCart1->GetTax()  ."") . "|" WA_eCDB_ConvertNumber("".$eCart1->GrandTotal()  ."") . "|" "".$date(m/d/Y)  ."" "|" "".((isset($_POST["firstname"]))?$_POST["firstname"]:"")  ." ".((isset($_POST["lastname"]))?$_POST["lastname"]:"")  ."" "|" "".((isset($_SERVER["REMOTE_ADDR"]))?$_SERVER["REMOTE_ADDR"]:"")  ."";
  
$WA_columnTypesStr "',none,''|',none,''|none,none,NULL|none,none,NULL|none,none,NULL|',none,''|',none,''|',none,''";
  
$WA_sessionName "eCart1_OrderID";
  
$WA_Sql "";
  
$NeedInsert false;
  
$indexFieldIndex = -1;
  
$WA_fieldValues explode("|"$WA_fieldValuesStr);
  
$WA_columns explode("|"$WA_columnTypesStr);
  
$WA_connectionDB $database_ba;
  
$updateFieldValue "";
  
mysql_select_db($WA_connectionDB$WA_connection);
  if (!
session_id()) session_start();
  if (
$WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
    
$WA_redirectURL .= ((strpos('?'$WA_redirectURL) === false)?"?":"&").$_SERVER["QUERY_STRING"];
  }
  
$WA_fieldNames explode("|"$WA_fieldNamesStr);
  
$WA_columns explode("|"$WA_columnTypesStr);
  for (
$i 0$i sizeof($WA_fieldNames); $i++)
  {
    if (
$WA_indexField  == $WA_fieldNames[$i])
    {
      
$indexFieldIndex $i;
      break;
    }
  }
  
$deleteFieldValue "";
  
$updateColType "none,none,NULL";
  if (
$indexFieldIndex >= 0$updateFieldValue $WA_fieldValues[$indexFieldIndex];
  if (
$updateFieldValue == "" && isset($_SESSION[$WA_sessionName])) $updateFieldValue $_SESSION[$WA_sessionName];
  if (
$indexFieldIndex >= 0$updateColType $WA_columns[$indexFieldIndex];
  if (
$updateFieldValue != "")     {
    
$updateParamsObj WA_generateInsertParams($WA_fieldNames$WA_columns$WA_fieldValues$indexFieldIndex);
    
$valueForWhere WA_generateInsertParams(array($WA_indexField), array($updateColType), array($updateFieldValue), -1);
    
$WA_Sql "update " $WA_table " SET " $updateParamsObj->WA_setValues " where " $WA_indexField " = " $valueForWhere->WA_dbValues;
    
$WA_editCmd mysql_query($WA_Sql$WA_connection) or die(mysql_error());
    
$_SESSION[$WA_sessionName] = $updateFieldValue;
    
$result mysql_query("SELECT * FROM " $WA_table " where " $WA_indexField " = " $valueForWhere->WA_dbValues$WA_connection);
    
$num_rows mysql_num_rows($result);
    
$NeedInsert = (mysql_num_rows($result) === 0);
  }
  if (
$updateFieldValue === "" || $NeedInsert)  {
    
$updateFieldValue "";
    
$insertParamsObj WA_generateInsertParams($WA_fieldNames$WA_columns$WA_fieldValues, -1);
    
$WA_Sql "insert into " $WA_table " (" $insertParamsObj->WA_tableValues ") values (" $insertParamsObj->WA_dbValues ")";
    
$WA_editCmd mysql_query($WA_Sql$WA_connection) or die(mysql_error());
    
$_SESSION[$WA_sessionName] = mysql_insert_id();
  }
  if (
$WA_redirectURL != "")  {
    
header("Location: ".$WA_redirectURL); exit;
  }
}
?>



Any suggestions?

Sign in to reply to this post

Jason ByrnesWebAssist

I think I see the problem. You have the date code as:

$date(m/d/Y)

it should be:
$date("m/d/Y")


change line 306 to:

php:
$WA_fieldValuesStr = "".session_id()  ."" . "|" . "".((isset($_POST["email"]))?$_POST["email"]:"")  ."" . "|" . WA_eCDB_ConvertNumber("".$eCart1->GetShipping()  ."") . "|" . WA_eCDB_ConvertNumber("".$eCart1->GetTax()  ."") . "|" . WA_eCDB_ConvertNumber("".$eCart1->GrandTotal()  ."") . "|" . "".$date("m/d/Y")  ."" . "|" . "".((isset($_POST["firstname"]))?$_POST["firstname"]:"")  ." ".((isset($_POST["lastname"]))?$_POST["lastname"]:"")  ."" . "|" . "".((isset($_SERVER["REMOTE_ADDR"]))?$_SERVER["REMOTE_ADDR"]:"")  ."";
Sign in to reply to this post

tom92909Beta Tester

Yes. That helped.

Thank you.

Sign in to reply to this post

Jason ByrnesWebAssist

Excellent, glad to hear it.

Sign in to reply to this post

joczan389207

Fatal error: Function name must be a string

I am having Trouble with something similar.

I am trying to create a php script for an online form, and the following appears:
Fatal error: Function name must be a string in D:\Hosting\3560291\html\contactformprocess.php on line 9

My code is the one below, can someone tell me whats wrong with it?

<?php

/* Subject and Email Variables */

$emailSubject = 'September 19th registration!';
$webMaster = 'cesct@ntplx.net';

/* Gathering Data Variables */
$emailFiled = $_POST('email');
$nameField = $_POST('name');
$phoneField = $_POST('phone');
$addressField = $_POST('address');
$hearField = $_POST('hear');
$travelersField = $_POST('travelers');
$commentsField = $_POST('comments');


$body = <<< EOD
<br><hr><br>
Email: $email <br>
Name: $name <br>
Phone: $phone <br>
Address: $address <br>
How did you hear about us?: $hear <br>
How many will be attending?: $travelers <br>
Comments: $comments <br>
EOD;

$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);

/* Results rendered as HTML */

$theResults = <<< EOD
<html>
<head>
<title>Connecticut Educational Services</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-color: #f1f1f1;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
line-height: normal;
font-weight: normal;
color: #666666;
text-decoration: none;
}
-->
</style>
<head>

<div>
<div align="left">Thank you for your interest! Your email will be answered very soon!</div>
</div>
</body>
</html>
EOD;
echo "$theResults";

Sign in to reply to this post

Jason ByrnesWebAssist

your syntax for referring to form elements is not correct.

php:
$emailFiled = $_POST('email');

$nameField = $_POST('name');
$phoneField = $_POST('phone');
$addressField = $_POST('address');
$hearField = $_POST('hear');
$travelersField = $_POST('travelers');
$commentsField = $_POST('comments');




needs to be changed to:

php:
$emailFiled = $_POST['email'];

$nameField = $_POST['name'];
$phoneField = $_POST['phone'];
$addressField = $_POST['address'];
$hearField = $_POST['hear'];
$travelersField = $_POST['travelers'];
$commentsField = $_POST['comments'];
Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...