note 8449 added to mysql_num_fields
| From: | dubious at 2xtreme dot net | Date: | Wed, 13 Sep 2000 06:35:26 +0000 |
| Subject: | note 8449 added to mysql_num_fields | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-4800@lists.php.net to get a copy of this message | ||
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?
http://www.php.net/manual/function.mysql-num-fields.php