Jump to content


Photo

Invalid Resource


  • Please log in to reply
No replies to this topic

#1 steelmanronald06

steelmanronald06
  • Staff Alumni
  • Advanced Member
  • 2,004 posts
  • LocationOk

Posted 08 June 2006 - 09:06 PM

Question:

"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?


Answer:

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.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users