tags:

views:

49

answers:

2
$select = "SELECT * FROM `jos_users`";

$connection->setQuery($select);

$rows = $connection->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?

A: 

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

+2  A: 
<?
$select = "SELECT * FROM `jos_users`";

$connection->setQuery($select);

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

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

You're setting the query but not executing it.

Mike Sherov
Thanks to both of you. Stackoverflow rocks!!! I will never post in forums.joomla.org again because the chance of getting answered is about 1/10. Cheers Carlos.
You should also replace `jos_` with `#__` in your queries so that Joomla will use the correct table prefix (not necessarily `jos_`) - i.e. your query would be `SELECT * FROM \`#__users\``
DisgruntledGoat