• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 77
  • Last Modified:

Run an sql script within Joomla

Goal: run a custom script inside Joomla to get usable data back. I was doing the following as a test:
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
    ->select('count (*) from jos_users');
// Reset the query using our newly populated query object.
// Load the results as a list of stdClass objects (see later for more options on retrieving data).
$results = $db->loadObjectList();

Open in new window

and i put it together with other scripts running queries. It would not run - how do i get it to run?
  • 2
1 Solution
Ray PaseurCommented:
What does "would not run" mean?  Were there any error messages or logs?  Was there any output?  Please give us a little more to go on, thanks.
CEHJAuthor Commented:
Sorry Ray - i've got it fixed now. The reason was all sorts of bootstrapping code was apparently required
CEHJAuthor Commented:
Fixed it
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now