how to print db_select result using watchdog? I'm trying to debug below code:

$perishables = db_select('userpoints_txn', 'up_txn')
    -&gt;fields('up_txn', array('txn_id', 'uid', 'points', 'remainder', 'time_stamp', 'tid', 'operation', 'description'))
    -&gt;condition('status', 0, '=')
    -&gt;condition('expired', 0, '=')
    -&gt;condition('expirydate', 0, '!=')
    -&gt;condition('expirydate', REQUEST_TIME, '&lt;')
    -&gt;execute();
 watchdog('userpoints', 'perishables-&gt;remainder  %perrr', array('%perrr' =&gt;$perishables), WATCHDOG_DEBUG);


Can anyone help me how to get  $perishables in the report log files?
execute(): - this will not return query results to you. All it will return is database connection object and query string. See the screen shot.

In order to get query results, you need to call any of the retrieve function. For example

fetch();        // Use the default fetch mode. 

fetchObject();  // Fetch as a stdClass object.

fetchAssoc();   // Fetch as an associative array.
Debugging queries:

I would recommend you to use devel module and its help functions as dpm() and dpq() . They will make your debugging process a lot more faster can clean than watchdog.
watchdog() - I confirm the answer by @Decipher(+1) will record the query object in database, see the scrrenshot tested with a simple query



Might be that log is not something that you want to see, a small change to @Decipher answer if you want to see the query String

watchdog('userpoints', 'perishables-&gt;remainder %perrr', array('%perrr' =&gt; print_r($perishables-&gt;queryString, TRUE)), WATCHDOG_DEBUG);


You can definitely make it better the way you want with above mentioned tools