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!
$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 );
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.