Jump to content

Invalid Resource


Recommended Posts

[b] Question:[/b]
[quote]
"I've been trying to echo my data using *insert fetching function here*, but i keep getting the error:

function(): invalid resource ID

what do i do? what's the problem?
[/quote]

[b]Answer:[/b]
[quote]
1) echo your query that you've no doubt assigned as a string

2) add an or die() clause that details the error (usually using mysql_error()) to the end of your mysql_query() statement - NOTE: IF YOU'RE SITTING THERE SAYING "WHAT MYSQL_QUERY() STATEMENT?"

3) ensure that you're using the RESOURCE returned from mysql_query() and not the query string itself

4) If you're getting an error on mysql_close() about an invalid MySQL-Link resource, it's probably because you haven't done mysql_connect() properly. And just a note: mysql_close() is effectively run when your script ends, since the connection is broken, so it's more or less unnecessary. Unless you plan on connecting to another database or server after you close that connection.
[/quote]
Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.