Databases 1 min read

PDO::errorCode – Retrieve the SQLSTATE of the Last Database Operation

PDO::errorCode is a PHP method that returns the SQLSTATE code—a five‑character identifier defined by the ANSI SQL standard—representing the outcome of the most recent operation on a database handle, or NULL if no operation has been performed.

Laravel Tech Community
Laravel Tech Community
Laravel Tech Community
PDO::errorCode – Retrieve the SQLSTATE of the Last Database Operation

mixed PDO::errorCode(void)

Returns an SQLSTATE, a five‑character identifier defined in the ANSI SQL standard, consisting of a two‑character class value followed by a three‑character subclass value.

Parameters

This function takes no parameters.

Return value

If the database handle has not performed any operation, it returns NULL ; otherwise it returns the SQLSTATE string.

DatabasephperrorCodePDOSQLSTATE
Laravel Tech Community
Written by

Laravel Tech Community

Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.