$dbwsk = JFactory::getDBO();
$querywsk = "SELECT `title` FROM `#__content` WHERE 1";
$rowswsk = $dbwsk->loadResult();

I've been working and learning for the whole day and my brain kind of stops working. I am trying to get all values of a column from a certain table, above is the code, but $rowswsk only contains 1 string, which is the title of the first article. Why is this? And how should I do it?

1 Answer 1


You should use loadColumn instead of loadResult. loadResult is used when you want to get only 1 value from the query (and is typically used when the query returns just one value), loadColumn is used to return a whole column in an array. See Joomla's official documentation on selecting data from a database.

  • @shenkwen There isn't a better solution than this. Please award this answer the green tick so that your question is deemed resolved within the system. p.s. You don't need that WHERE 1 bit. Commented Jun 8, 2018 at 7:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.