Ambil data dari database dengan PDO

$host = 'localhost'; // URL to the server
$username = 'root'; // Username (xampp = root)
$password = ''; // Password (xampp = )
$dbname = 'apifile';
$pdo = new PDO("mysql:host=$host;dbname=$dbname", $username, $password);
$sql = "SELECT * FROM `prop` WHERE propkey='localhost_100100'";

$q = $pdo->query($sql);

$q->setFetchMode(PDO::FETCH_ASSOC);
$r = $q->fetch();
var_dump($r['propvalue']);
Amin Arjmand