$dbh->getOne($query, $params = array())

Started by beingchinmay, 08-11-2016, 07:22:02

Previous topic - Next topic

beingchinmayTopic starter

The getOne() method returns the first column from the first row of data. Use the $params parameter if $query contains placeholders (this applies to the rest of the convenience functions, too). Here's an exampl

Quote$name = $dbh->getOne('SELECT name FROM users WHERE id = ?',
array($_GET['userid']));