Note that there are some explanatory texts on larger screens.

plurals
  1. POZend Framework 2 logging to MySQL DB additional columns inserting null
    primarykey
    data
    text
    <p>I have the following section of code I'm struggling with to get to write to a MySQL database from a Paypal transaction. I've only included the relevant Zend DB log section, the Paypal interface is working fine, as per the data output.</p> <pre><code>$paypalLog = array( 'transactionId' =&gt; 'transactionId', 'transactionType' =&gt; 'transactionType', 'paymentType' =&gt; 'paymentType', 'orderTime' =&gt; 'orderTime', 'amt' =&gt; 'amt', 'currencyCode' =&gt; 'currencyCode', 'feeAmt' =&gt; 'feeAmt', 'taxAmt' =&gt; 'taxAmt', 'paymentStatus' =&gt; 'paymentStatus', 'pendingReason' =&gt; 'pendingReason', 'reasonCode' =&gt; 'reasonCode' ); $data = array( 'transactionId' =&gt; $transactionId, 'transactionType' =&gt; $transactionType, 'paymentType' =&gt; $paymentType, 'orderTime' =&gt; $orderTime, 'amt' =&gt; $amt, 'currencyCode' =&gt; $currencyCode, 'feeAmt' =&gt; $feeAmt, 'taxAmt' =&gt; $taxAmt, 'paymentStatus' =&gt; $paymentStatus, 'pendingReason' =&gt; $pendingReason, 'reasonCode' =&gt; $reasonCode ); $mapping = array( 'message' =&gt; 'message', 'extra' =&gt; $data); print_r($mapping); $writer = new Zend\Log\Writer\Db($db, 'paypal', $paypalLog); $logger = new Zend\Log\Logger(); $logger-&gt;addWriter($writer); $logger-&gt;info($mapping); </code></pre> <p>When I run my code the print returns the following so the data is available</p> <pre><code>Array ( [message] =&gt; message [extra] =&gt; Array ( [transactionId] =&gt; 03V084280U905161H [transactionType] =&gt; expresscheckout [paymentType] =&gt; instant [orderTime] =&gt; 2013-02-12T01:16:40Z [amt] =&gt; 9.00 [currencyCode] =&gt; AUD [feeAmt] =&gt; 0.52 [taxAmt] =&gt; 0.00 [paymentStatus] =&gt; Completed [pendingReason] =&gt; None [reasonCode] =&gt; None ) ) </code></pre> <p>My table is defined as the following, and I've granted full permissions to user.</p> <pre><code>CREATE TABLE `paypal` ( `timestamp` varchar(45) DEFAULT NULL, `priority` varchar(45) DEFAULT NULL, `priorityName` varchar(45) DEFAULT NULL, `message` varchar(45) DEFAULT NULL, `transactionId` varchar(45) NOT NULL, `transactionType` varchar(45) DEFAULT NULL, `paymentType` varchar(45) DEFAULT NULL, `orderTime` datetime DEFAULT NULL, `amt` varchar(45) DEFAULT NULL, `currencyCode` varchar(45) DEFAULT NULL, `feeAmt` varchar(45) DEFAULT NULL, `taxAmt` varchar(45) DEFAULT NULL, `paymentStatus` varchar(45) DEFAULT NULL, `pendingReason` varchar(45) DEFAULT NULL, `reasonCode` varchar(45) DEFAULT NULL, PRIMARY KEY (`transactionId`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1$$ </code></pre> <p>However when I run a trace on the MySQL side of things it just keeps trying to insert empty values.</p> <pre><code>130212 12:19:38 29 Connect user@localhost on database 29 Query INSERT INTO `paypal` () VALUES () 29 Quit </code></pre> <p>Any ideas welcome !!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload