Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End php variables Reply To: php variables

#171538
__
Participant

can you say the way to escape in that php pdo wrapper class??

The wrapper class you’re using extends PDO, so it already has the quote method. You can “just use it.”

Ok thanks for the advice and while binding if user inputs invalid error how to display it???

PDO uses exceptions by default, so you can just wrap your code in a try‚Ķcatch block. PDO exceptions can contain sensitive information (including DB credentials), so be sure you don’t show them on the “live” site.

try{
    $DB->somethingThatMightCauseAnError();
}
catch( PDOException $PDOe ){
    if ( $youAreDebugging ){
        echo $PDOe->getMessage();
    }
    else{
        echo "<p>sorry, something went wrong.</p>";
    }
}

and i got all the great answer so how to close this thread

Can’t close. Don’t worry about it.