[BASIC] how to fetch one single value?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
pedrotuga
Forum Contributor
Posts: 249
Joined: Tue Dec 13, 2005 11:08 pm

[BASIC] how to fetch one single value?

Post by pedrotuga »

Every time i need to get a value from a database i use mysql_fetch_row() and then get $row[0].

is there a simpler way to do that?
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

User avatar
pedrotuga
Forum Contributor
Posts: 249
Joined: Tue Dec 13, 2005 11:08 pm

Post by pedrotuga »

well its basically the same...

i guess we allways have to feth the result.

thanks anyway.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

useful idiom is:

Code: Select all

list($id) = mysql_fetch_row($res);
Post Reply