PHP/MySQL syntax

software development

#1

I am using the php command ‘mysql_num_fields()’

and when I upload it to the server, I get this error message:
‘supplied argument is not a valid MySQL result resource’

I’m not sure why?

Any ideas?

Thanks,
Michael Mulvey


#2

Hi

Is there a chance you can post your entire code snippet so we can see exactly what you’re doing?

I’m no PHP expert, but from waht I see in the online docs:

http://www.php.net/manual/en/function.mysql-num-fields.php

You need to specify an argument with that function. That is, you need to first select infroamtion from the database and pass it onto num-fields(). Something like this:

[code]$db_id = mysql_connet();
$result = mysql_query("DESCRIBE [tableName], $db_id);

$numFields = mysql_num_rows($result);
[/code]Hope this helps.

Wil

Web Developer
http://www.fbagroup.co.uk/