steelmanronald06 Posted June 8, 2006 Share Posted June 8, 2006 [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 IDwhat do i do? what's the problem?[/quote][b]Answer:[/b][quote]1) echo your query that you've no doubt assigned as a string2) 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 itself4) 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 https://forums.phpfreaks.com/topic/11524-invalid-resource/ Share on other sites More sharing options...
Recommended Posts