note 8449 deleted from function.mysql-num-fields by felipe
| From: | felipe@php.net | Date: | Mon, 21 Jul 2008 01:16:00 +0000 |
| Subject: | note 8449 deleted from function.mysql-num-fields by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-142381@lists.php.net to get a copy of this message | ||
Note Submitter: dubious at 2xtreme dot net
----
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?