2
Contributors
5
Replies
7
Views
9 Years
Discussion Span
Last Post by still_learning
0

And by length I mean the current length of a row. Not max length or anything. If there are 5 columns in the row, then I want to be able to print "the length of this row is 5"

0

hi still learning,

obviously, by "length" you mean the number of columns of a table. Such information can easily be get by querying the system catalogue/tables of a database, as for MySql it should be similar like this:

select count(COLUMN_NAME) as 'The length of this row is:'
  from INFORMATION_SCHEMA.COLUMNS
     where table_name = 'yourTableName'

Furthermore, ODBC offers a rather standardized method to query system tables independently of a specific database, you may search on msdn.

I hope that helps you.

krs,
tesu

0

Thanks for the reply. I just figured it out right before you replied. I just simply used mysql_num_fields

0

Thanks for the reply. I just figured it out right before you replied. I just simply used mysql_num_fields

Does this really solve your problem? As I have known mysql_num_fields returns number of columns in a particular select but not the number of rows of a given table, does it?

krs,
tesu

0

Yes this does solve my problem. When I said "length of a row" I should have said something more like "the size or amount of elements in a row." Basically I wanted to know how long a row was so I needed to know how many columns there were.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.