AdrianR Posted March 10, 2006 Share Posted March 10, 2006 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:) Link to comment https://forums.phpfreaks.com/topic/4635-how-to/ Share on other sites More sharing options...
hitman6003 Posted March 11, 2006 Share Posted March 11, 2006 [!--quoteo(post=353715:date=Mar 10 2006, 03:55 PM:name=adrianR)--][div class=\'quotetop\']QUOTE(adrianR @ Mar 10 2006, 03:55 PM) [snapback]353715[/snapback][/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:[code]$query = "SHOW COLUMNS FROM tablename";$result = mysql_query($query);$colcount = mysql_num_rows($result);[/code][!--quoteo(post=353715:date=Mar 10 2006, 03:55 PM:name=adrianR)--][div class=\'quotetop\']QUOTE(adrianR @ Mar 10 2006, 03:55 PM) [snapback]353715[/snapback][/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] [color=blue]COUNT[/color](fieldname) [color=green]FROM[/color] [color=orange]tablename[/color] [color=green]WHERE[/color] fieldname ![color=orange]=[/color] NULL [color=blue]AND[/color] fieldname ![color=orange]=[/color] "" [!--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) [snapback]353715[/snapback][/div][div class=\'quotemain\'][!--quotec--]thanks in advance:)[/quote]Your welcome, afterward. Link to comment https://forums.phpfreaks.com/topic/4635-how-to/#findComment-16294 Share on other sites More sharing options...
AdrianR Posted March 11, 2006 Author Share Posted March 11, 2006 yes,i think that's what I need,i'm gonna test it now.Thanks a lot:) Link to comment https://forums.phpfreaks.com/topic/4635-how-to/#findComment-16371 Share on other sites More sharing options...
AdrianR Posted March 11, 2006 Author Share Posted March 11, 2006 yes,i think that's what I need,i'm gonna test it now.Thanks a lot:) Link to comment https://forums.phpfreaks.com/topic/4635-how-to/#findComment-16372 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.