Jump to content


Photo

how to...


  • Please log in to reply
3 replies to this topic

#1 AdrianR

AdrianR
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 10 March 2006 - 08:55 PM

People how can I get the number of field in a table?
and how can i get the number of entrys in a field?
thanks in advance:)

#2 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 11 March 2006 - 01:27 AM

[!--quoteo(post=353715:date=Mar 10 2006, 03:55 PM:name=adrianR)--][div class=\'quotetop\']QUOTE(adrianR @ Mar 10 2006, 03:55 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
People how can I get the number of field in a table?
[/quote]

mysql_num_fields -- Get number of fields in result
[a href=\"http://www.php.net/mysql_num_fields\" target=\"_blank\"]http://www.php.net/mysql_num_fields[/a]

to get the number of columns in a table:
$query = "SHOW COLUMNS FROM tablename";
$result = mysql_query($query);
$colcount = mysql_num_rows($result);

[!--quoteo(post=353715:date=Mar 10 2006, 03:55 PM:name=adrianR)--][div class=\'quotetop\']QUOTE(adrianR @ Mar 10 2006, 03:55 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
and how can i get the number of entrys in a field?
[/quote]

Not sure what you mean.

You could do an sql query:
[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] COUNT(fieldname) FROM tablename WHERE fieldname != NULL AND fieldname != "" [!--sql2--][/div][!--sql3--]

[!--quoteo(post=353715:date=Mar 10 2006, 03:55 PM:name=adrianR)--][div class=\'quotetop\']QUOTE(adrianR @ Mar 10 2006, 03:55 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
thanks in advance:)
[/quote]

Your welcome, afterward.

#3 AdrianR

AdrianR
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 11 March 2006 - 08:15 AM

yes,i think that's what I need,i'm gonna test it now.Thanks a lot:)

#4 AdrianR

AdrianR
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 11 March 2006 - 08:15 AM

yes,i think that's what I need,i'm gonna test it now.Thanks a lot:)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users