开发者

'mysql_num_rows(): supplied argument is not a valid argument' when trying to use JDatabase

开发者 https://www.devze.com 2022-12-19 05:50 出处:网络
$select = \"SELECT * FROM `jos_users`\"; $connection->setQuery($select); $rows = $connection-&开发者_StackOverflow社区gt;getNumRows();
$select = "SELECT * FROM `jos_users`";

$connection->setQuery($select);

$rows = $connection-&开发者_StackOverflow社区gt;getNumRows();

$rows does not work it throws the 'mysql_num_rows(): supplied argument is not a valid' error but...

$result = $connection->loadObjectList();

$result works fine.

Is this a Joomla bug?? Or what am i doing wrong?


<?
$select = "SELECT * FROM `jos_users`";

$connection->setQuery($select);

//add this:
$connection->query();

$rows = $connection->getNumRows();
?>

You're setting the query but not executing it.


would it need to call query()... $res = $db->query('select * from jos_users'); $db->getNumRows($res);

0

精彩评论

暂无评论...
验证码 换一张
取 消