?
Solved

Run an sql script within Joomla

Posted on 2016-10-24
3
Medium Priority
?
54 Views
Last Modified: 2016-10-29
Goal: run a custom script inside Joomla to get usable data back. I was doing the following as a test:
<?php
$db = JFactory::getDbo();
 
// Create a new query object.
$query = $db->getQuery(true);
$query
    ->select('count (*) from jos_users');
// Reset the query using our newly populated query object.
$db->setQuery($query);
// Load the results as a list of stdClass objects (see later for more options on retrieving data).
$results = $db->loadObjectList();
print_r($results);
?>

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?
0
Comment
Question by:CEHJ
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 41856857
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.
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 0 total points
ID: 41856858
Sorry Ray - i've got it fixed now. The reason was all sorts of bootstrapping code was apparently required
0
 
LVL 86

Author Closing Comment

by:CEHJ
ID: 41865076
Fixed it
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question