I am building a string variable called $order_sql. It is basically like this:
**$order_sql = "INSERT INTO TEMPTABLE Cust_no, Order_no VALUES ('10', '5')";
**
The problem I am having is that the Cust_no and Order_no are stored in an associative array called $order, so I am trying to do the following:
**"... VALUES ($order ['Customer No'], $order ['Order No'])"
**
but I do not get the 10 and 5, but this:
**"... VALUES (Array['Customer No'], Array['Order No'])"
**
However if I assign the array values to variables first, such as
**$CustNo = $order ['Customer No']; $OrderNo = $order ['Order No'];
**
and then use these variables
**"... VALUES (\'$CustNo\', \'$OrderNo\' )";
**
I get the desired result:
**"... VALUES ('10', '5')";
**
This seems similar the Prepared Statements information in post How to include a PHP variable inside a MySQL statement
but I am not using MySQL. The SQL sting I am preparing is sent via a SOAP API call, which is then executed within that to actually run the SQL on the database.