Page 1 of 1

mysql_list_fields() and mysql_num_fields() error...

Posted: Sat Mar 13, 2004 7:03 pm
by struggling_student
hi

when i try to run this within a function:

$Result = mysql_fetch_field($dbname, $tablename);
$num = mysql_num_fields ($Result);

i get the following errors in my page:

Warning: mysql_list_fields(): Unable to save MySQL query result

and

Warning: mysql_num_fields(): supplied arguement is not a valid MySQL result resource

Can anyone help???!

Posted: Sat Mar 13, 2004 9:00 pm
by Illusionist
are oyu connecting to the database and quering anything??

Posted: Sat Mar 13, 2004 9:05 pm
by Illusionist
your using that int he wrong way anyways. First you need to connect to the database, then select a database. then query an SQL statement then you can call mysql_fetch_feilds after getting teh result, and you would use it like:

Code: Select all

$result = mysql_query($SQL);
$f = mysql_fetch_field($result);
http://php.ru.ac.za/manual/en/function. ... -field.php