duanli0119 2017-12-04 23:06
浏览 51
已采纳

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!

  • 写回答

2条回答 默认 最新

  • douyingzhan5905 2017-12-05 00:01
    关注

    SELECT acc_id FROM account_info ORDER BY acc_id DESC LIMIT 1

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥50 三种调度算法报错 有实例
  • ¥15 关于#python#的问题,请各位专家解答!
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败
  • ¥20 java在应用程序里获取不到扬声器设备