Note that there are some explanatory texts on larger screens.

plurals
  1. POcode igniter active records query missing apostrophes
    text
    copied!<p>Code igniter is spitting out:</p> <pre><code>A Database Error Occurred Error Number: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TEST, `cardNumber` = 411111........11, `cardExpiry` = 1212, `authCode` = 110200,' at line 1 UPDATE `pxpayRequest` SET `status` = 'approved', `cardName` = Visa, `cardHolder` = VISA TEST, `cardNumber` = 411111........11, `cardExpiry` = 1212, `authCode` = 110200, `dpsTxnRef` = 0000000800b51dde, `dpsMessage` = APPROVED WHERE `id` = 1 </code></pre> <p>And, as is obvious it is due to the missing sets of <code>'</code></p> <p>Why is code igniter not putting these in properly?</p> <p>Here is my code:</p> <pre><code>$id = $result-&gt;MerchantReference; $cardName = $result-&gt;CardName; $cardHolder = $result-&gt;CardHolderName; $cardNumber = $result-&gt;CardNumber; $cardExpiry = $result-&gt;DateExpiry; $authCode = $result-&gt;AuthCode; $dpsRef = $result-&gt;DpsTxnRef; $dpsMessage = $result-&gt;ResponseText; $this-&gt;db-&gt;set('status', 'approved') -&gt;set('cardName', $cardName) -&gt;set('cardHolder', $cardHolder) -&gt;set('cardNumber', $cardNumber) -&gt;set('cardExpiry', $cardExpiry) -&gt;set('authCode', $authCode) -&gt;set('dpsTxnRef', $dpsRef) -&gt;set('dpsMessage', $dpsMessage) -&gt;where('id', $id) -&gt;update('pxpayRequest'); </code></pre> <p>You can see the associated values by looking at the query above.</p> <p>Here is the <code>print_r</code> of $result</p> <pre><code>SimpleXMLElement Object ( [@attributes] =&gt; Array ( [valid] =&gt; 1 ) [Success] =&gt; 1 [TxnType] =&gt; Purchase [CurrencyInput] =&gt; NZD [MerchantReference] =&gt; 1 [TxnData1] =&gt; SimpleXMLElement Object ( ) [TxnData2] =&gt; SimpleXMLElement Object ( ) [TxnData3] =&gt; SimpleXMLElement Object ( ) [AuthCode] =&gt; 121132 [CardName] =&gt; Visa [CardHolderName] =&gt; VISA CARD [CardNumber] =&gt; 411111........11 [DateExpiry] =&gt; 1212 [ClientInfo] =&gt; 125.236.220.238 [TxnId] =&gt; 4ddd9aa1dd14c [EmailAddress] =&gt; SimpleXMLElement Object ( ) [DpsTxnRef] =&gt; 0000000800b5d3c9 [BillingId] =&gt; SimpleXMLElement Object ( ) [DpsBillingId] =&gt; SimpleXMLElement Object ( ) [AmountSettlement] =&gt; 8.00 [CurrencySettlement] =&gt; NZD [DateSettlement] =&gt; 20110526 [TxnMac] =&gt; BD43E619 [ResponseText] =&gt; APPROVED [CardNumber2] =&gt; SimpleXMLElement Object ( ) [IssuerCountryId] =&gt; 0 ) </code></pre>
 

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