What is mysql_num_fields() function in PHP?
How does mysql_num_fields() works?
<?php //Attempt to connect to the default database server $link = mysql_connect("mysql_host", "mysql_user", "mysql_password")or die ("Could not connect"); //select database mysql_select_db("database", $link);//execute simple query $sql = mysql_query("SELECT * FROM table1", $link);$result = mysql_query($sql,$link); //Fetch number of fields in the result set $fields=mysql_num_fields($result);//print number of fields in the result set echo"No of fields: ".$fields; //Close connection mysql_close($link);?> |