Guest Posted July 9, 2006 Share Posted July 9, 2006 Hey all,I'm having a little problem with PHP and its mysql commands, I've set up apache 2.2 with php 5, installed coldfusion on it, and datasource access worked fine. Then I went over to PHP, and I tried to recreate the exact same thing as is present in the CFML version... So far so good.And then I get to a point where mysql_* commands beyond mysql_pconnect/connect get me a 'not a valid resource' error!I've done some tinkering and it turns out that the mysql_* commands (with exception to the connect and pconnect functions) return a boolean rather then a resource![code] $db = mysql_pconnect( $host, $user, $pass ) or die(mysql_error()); mysql_select_db( 'dbinventory', $db ); $q_INV = "SELECT * FROM tblMedia"; # Returns a boolean, but I want it to return a resource! $rs_INV = mysql_query( $q_INV, $db ); $rs_INV_rows = mysql_num_rows( $rs_INV ); $rs_INV_cols = mysql_num_fields( $rs_INV );[/code]Simple no? But, as I tried our rs_INV with the is_resource and is_bool, it comes out boolean regardless of what I try.Any suggestions? Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted July 9, 2006 Share Posted July 9, 2006 Try putting [code] or die(mysql_error())[/code] after the mysql_query so it becomes [code]$rs_INV = mysql_query( $q_INV, $db ) or die(mysql_error());[/code] and see if it returnss any error. Quote Link to comment Share on other sites More sharing options...
fenway Posted July 10, 2006 Share Posted July 10, 2006 Agreed... that bool is probably FALSE, indicating an error. Quote Link to comment Share on other sites More sharing options...
Guest Posted July 10, 2006 Share Posted July 10, 2006 [quote author=Daniel0 link=topic=99960.msg394006#msg394006 date=1152457437]Try putting [code] or die(mysql_error())[/code] after the mysql_query so it becomes [code]$rs_INV = mysql_query( $q_INV, $db ) or die(mysql_error());[/code] and see if it returnss any error.[/quote]Thanks Daniel, silly that I didn't think of that sooner! But yea, cleared up the problem and I fixed it (user wasn't permitted to access remotely).Thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.