SQL请求返回源ID

时间:2010-11-26 23:17:44

标签: mysql

我正在做这个请求: $uid = db_query("SELECT uid FROM tablename WHERE mail = 'test@test.com' LIMIT 1")

得到结果:

资源ID#310

但我想得到这个uid。错误在哪里?

1 个答案:

答案 0 :(得分:0)

db_query("SELECT uid FROM tablename WHERE mail = 'test@test.com' LIMIT 1");

只是给你一个“答案”,但你想要它的价值。试试这个:

$result = db_query("SELECT uid FROM tablename WHERE mail = 'test@test.com' LIMIT 1");
$row = db_fetch_array($result);
$uid = $row[0];