SELECT WHERE语句

I am trying to select the a value from the database such as

 $stmt = $pdo->query('SELECT acc_id FROM account_info WHERE acc_id = (the most recent value entered ');

i tried :

$stmt = $pdo->query('SELECT acc_id FROM account_info WHERE acc_id = "26" '); 

and it was successful. However whenever I try something like :

$stmt = $pdo->query('SELECT acc_id FROM account_info WHERE acc_id = :acc_id');

or

$stmt = $pdo->query('SELECT acc_id FROM account_info WHERE acc_id = $acc_id ');

i get the following error :

core.js:1350 ERROR SyntaxError: Unexpected token S in JSON at position 0
at JSON.parse (<anonymous>)

my TS code :

load()
{
this.http.get('http://localhost:10080/ionic/patients.php')
  .map(res => res.json())
  .subscribe(data =>
  {
     this.items = data;
  });
 }

  viewEntry(param)
{
 this.navCtrl.push('AccInfoPage',param);
}

and this is my HTML:

<ion-item *ngFor="let item of items">
<h2>{{ item.acc_id }} </h2>
<button ion-button color="primary" item-right (click)="viewEntry({ account: item })">View</button>
 </ion-item>

What am I doing wrong ? How can I fix it ?? Thank you in advance!

SELECT acc_id FROM account_info ORDER BY acc_id DESC LIMIT 1

If you want to create and execute a prepared statement, you need to prepare the query first, bind parameters and then execute.

$stmt = $pdo->prepare('SELECT acc_id FROM account_info WHERE acc_id = :acc_id');
$stmt->execute([':acc_id' => 26]);
$result = $stmt->fetchAll();