Examples? How about this for a highly contrived but hopefully understandable example:
------------------------
<?php
function DoAQuery($Query)
{
$Result=mysql_db_query($Query);
$NumberOfFields=mysql_num_fields($Result);
print("There are $NumberOfFields Columns in the result<br>");
}
$ConnectionResource=mysql_connect("localhost","User","Password");
$Query="SELECT This, That, TheOther from Some_Table ORDER BY This";
DoAQuery($Query);
?>
-------------------------
Presuming I did that right, the entire output of this snippet should be "There are 3 Columns in the result" (assuming you actually have a mysql database with those fields, etc.) Presumably, in the Real World, you'd be using mysql_num_fields for formatting and such.
Hey, I SAID it was highly contrived, didn't I?