Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
ralmeida
· 15y ago · 0 comments
I would just add a fetch_scalar() function. It makes some common operations get very readable:
$total_users = $db->fetch_scalar("SELECT COUNT(*) FROM users");
Comments
[–]
leftnode
15y ago
fetch_column() does essentially that. You can pass in the column number you want fetched, in this case, it would be the 0th column.
[–]
ralmeida
OP
15y ago
I know. I would at least add it as an alias to $fetch_column(0), out of sheer readability preciosism =D