Jump to content

Quick PDO question


Eiolon

Recommended Posts

I am starting to learn PDO by re-writing one of my existing scripts. Do I still need to validate $_GET or does PDO do the work for me?  Currently I am using:

 

$id = $_GET['id'];

$sth = $dbh->prepare('DELETE FROM van_reservations WHERE id = :id');
$sth->bindParam(':id', $id, PDO::PARAM_INT);
$sth->execute();

 

I used to validate by using this:

 

$id = isset($_GET['id']) && is_numeric($_GET['id'])?(int) $_GET['id']:0;

Link to comment
https://forums.phpfreaks.com/topic/247790-quick-pdo-question/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.