errorInfo(); if ($errorInfo[0] != '00000') { // If there's an error (the SQLSTATE isn't '00000', which means no error) echo "Error: " . $errorInfo[2]; // The third element contains the error message } } ?>