Hey guys,

Is there any way that I can just simply get the length of a row in a table? Thanks

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"

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

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

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

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.