addressalign-toparrow-leftarrow-leftarrow-right-10x10arrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscontroller-playcredit-cardcrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobe--smallglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1languagelaunch-new-window--smalllight-bulblightning-boltlinklocation-pinlockm-swarmSearchmailmediummessagesminusmobilemoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonprintShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstar-shapestartickettrashtriangle-downtriangle-uptwitteruserwarningyahooyoutube

Re: [php-49] Re: PDO not PDOing

From: max s.
Sent on: Monday, September 19, 2016, 11:27 AM
Neat!

On Sep 19, 2016, at 11:10 AM, Noah <[address removed]> wrote:

I've developed a small library to help you more easily debug PDO errors. You can take a look at it here:

https://github.com/noahheck/E_PDOStatement

Instead of var_dump-ing and what not, this extension allows you to view the query with the values populated with the runtime values, especially helpful in your circumstance.



On Mon, Sep 19, 2016 at 12:05 PM, Tim Bond <[address removed]> wrote:
http://php.net/manual/en/pdostatement.errorinfo.php

Returns an array but you're not doing anything with it so you're not going to see what happens.

Also according to http://php.net/manual/en/pdostatement.execute.php it doesn't throw an exception so the try/catch isn't needed.  I may be wrong on that.

On 9/19/[masked]:02, Max wrote:
I am not sure if i am doing it correctly:

This is what I did:

try {$stmt->execute();} catch(PDOException $ex)
{trigger_error($ex->getMessage(), E_USER_ERROR);}
#feedback success or failure of update

$stmt->errorInfo();


if ($stmt->rowCount() > 0)
{//success!  provide feedback, chance to change another!
feedback("Content Updated!","success");
}else{//Problem!  Provide feedback!
feedback("Content NOT added!","warning");
}





On Sep 19, 2016, at 10:57 AM, Tim Bond <[address removed]
<mailto:[address removed]>> wrote:

$stmt->errorInfo()




--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
http://www.meetup.com/seaphp/
This message was sent by Meetup on behalf of Tim Bond (http://www.meetup.com/seaphp/members/[masked]/) from Seattle PHP User Group.
Set my mailing list to email me

As they are sent
http://www.meetup.com/seaphp/list_prefs/?pref=1

In one daily email
http://www.meetup.com/seaphp/list_prefs/?pref=2

Don't send me mailing list messages
http://www.meetup.com/seaphp/list_prefs/?pref=0
Meetup, POB 4668 #37895 NY NY USA 10163 | [address removed]






--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Meetup on behalf of Noah from Seattle PHP User Group.
To report this message, please click here
To block the sender of this message, please click here
Set my mailing list to email me As they are sent | In one daily email | Don't send me mailing list messages

Meetup, POB 4668 #37895 NY NY USA 10163 | [address removed]

People in this
group are also in: