PDA

View Full Version : Getting just the data back


Danger Fan
11-13-2002, 12:08 PM
When I run a query with mysql, I get it in table format. I want to get just the data back. Say I want to get an int out of my db, I run the select query, and I get:


-----------
| Table Name |
-----------
| |
| 5 |
-----------



I want just the 5 back. How do I do that?

Strike
11-13-2002, 01:31 PM
Sorry, everything you get back in MySQL is a table of some sort, even simple arithmetic:

mysql> select 5+3;
+-----+
| 5+3 |
+-----+
| 8 |
+-----+
1 row in set (0.00 sec)

Strike
11-13-2002, 01:32 PM
Er, I forgot to finish that.

Fortunately, every programming language that hooks into it returns it as some sort of sane data type (usually a 2D-array or something similar) that it should be easy to extract the data from that particular cell.