PHP Knowledge Base

Example of a PHP PDO SELECT Statement

NULL

$user  = 'root';
$pass  = '';
$dbh   = new PDO('mysql:host=localhost;dbname=fts', $user, $pass);
$query = "SELECT id, latitude, longitude FROM currentlocation ORDER BY id DESC";
$sth   = $dbh->prepare($query);
$sth->execute();

$result = $sth->fetch(PDO::FETCH_ASSOC);
Note:

Change $user, $pass to your MySql username, password.