PHP/MySQL syntax

software development


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?

Michael Mulvey



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:

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.


Web Developer