PHP/MySQL Database/mysql num fields
mysql_list_fields.php
<?
mysql_connect("localhost","root","");
$fields = mysql_list_fields("mydatabase","password");
echo mysql_num_fields($fields);
?>
mysql_num_fields.php
<?php
mysql_connect("localhost","root","");
mysql_select_db("mydatabase");
$query = "SELECT id, title FROM mytable ORDER BY title";
$result = mysql_query($query);
echo "Total number of fields returned: ".mysql_num_fields($result).".<br />";
?>