VirtualOdin
Technical User
I am a relative novice to PHP/MySQL, but this one really has me stumped.
The following statements work fine and return all the records from books where sector is IT.
$query = "select * from books where sector = 'IT' ";
$result = mysql_query( $query );
$numresults = mysql_num_rows( $result );
And these generate "Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource"
$sector = "IT";
$query = "select * from books where sector = $sector ";
$result = mysql_query( $query );
$numresults = mysql_num_rows( $result );
Any ideas on what could be going wrong?
I'd appreciate any ideas. I have tried what seems to be everything!
Tim
The following statements work fine and return all the records from books where sector is IT.
$query = "select * from books where sector = 'IT' ";
$result = mysql_query( $query );
$numresults = mysql_num_rows( $result );
And these generate "Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource"
$sector = "IT";
$query = "select * from books where sector = $sector ";
$result = mysql_query( $query );
$numresults = mysql_num_rows( $result );
Any ideas on what could be going wrong?
I'd appreciate any ideas. I have tried what seems to be everything!
Tim