Jump to content

Archived

This topic is now archived and is closed to further replies.

AdrianR

how to...

Recommended Posts

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:)

Share this post


Link to post
Share on other sites
[!--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.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.