23 votes
Accepted

How can I print out a Joomla query?

you need to echo __toString() echo($query->__toString()); you can fing more info here https://docs.joomla.org/API16:JDatabaseQuery/_toString Hope it helps
Piero Marsilio's user avatar
10 votes

How can I print out a Joomla query?

You can also use Joomla's replacePrefix function which dumps out the query in a format that can be inserted straight into the likes of PhpMyAdmin. Here's an example: $db = JFactory::getDbo(); $...
Lodder's user avatar
  • 26.8k
8 votes

Adding Multiple Users in Joomla

I see in the tags of your question you are using mysql and phpmyadmin, so I assume you are after a a way to INSERT records of users directly into the Joomla database. However please note that, the ...
FFrewin's user avatar
  • 19.6k
8 votes

JFactory::getDbo() deprecated-- what's the replacement?

If you are developing your extension only for Joomla 4.0+, you can replace $db = Factory::getDbo(); with $db = Factory::getContainer()->get('DatabaseDriver');
akfaisel's user avatar
  • 111
7 votes

JFactory::getDbo() deprecated-- what's the replacement?

Joomla 3.9.x has a file public_html/libraries/classmap.php that contains all the old style Class names, and the new replacements. E.g. JLoader::registerAlias('JFactory', '\\Joomla\\CMS\\Factory', '5....
pe7er's user avatar
  • 1,948
6 votes

How can I print out a Joomla query?

You can also use native dump() method: echo $query->dump();
Dmitrijs Rekuns's user avatar
6 votes
Accepted

with insert on duplicate key update - updating multiple rows at once

Building a REPLACE INTO query is just as simple as building an INSERT ... ON DUPLICATE KEY UPDATE. Note that there is a difference between REPLACE INTO AND ON DUPLICATE KEY UPDATE. Code: $columns = ...
mickmackusa's user avatar
  • 4,781
6 votes
Accepted

JFactory::getDbo() deprecated-- what's the replacement?

Your issue comes solely from confusion about Joomla! versions. These facts should clear the air: \Joomla\CMS\Factory::getDbo() is deprecated in 4.0 and will be removed in 5.0. It is alive and well in ...
Sharky's user avatar
  • 10.8k
6 votes
Accepted

Create a table observer

This was working ok on my instance Joomla 3.9.22 with PHP 7.3.5 (and mysql). Then to test this I selected PHP 7.0.33 instead and it gave me an error: Fatal error: Declaration of MyObserver::...
Robbie Jackson's user avatar
6 votes

Restoring with Akeeba to a new site on cpanel

Yes you will need to enter the details for the development server database at this step. By default, Akeeba Kickstart will display the database details from the site it was backed up from... it ...
Snaffle's user avatar
  • 146
6 votes
Accepted

Change database password?

The correct method is to update database password first, either via your hosting control panel or the command line. Then manually update the password in configuration.php either through the File ...
Snaffle's user avatar
  • 146
5 votes

How can I print out a Joomla query?

The JDatabaseQuery object has a __toString() function that outputs the query so you can do: echo $db->getQuery(); Or if you want to pass it to a function you can explicitly cast it to a string ...
Joomler's user avatar
  • 1,791
5 votes
Accepted

What is Joomla article options stored table?

The data you are looking for is available in same table (#__content) and you will find all the options in attribs column. Note that in MySQL the table will have the db table prefix that you have ...
Joomler's user avatar
  • 1,791
4 votes

Migrate users account from Joomla 3 to another Joomla 3 manually

Rather than migrating the users manually you could try some of the extensions available at Joomla Extensions Directory. This page contains several extensions, both free and commercial, you'd have to ...
johanpw's user avatar
  • 13.3k
4 votes
Accepted

Migrate meta keywords to tags

We have developed a script that does that and that can be found here. Essentially, we loop through articles and then we grab the keywords, add them as tags, and then tag the articles. We have mainly ...
itoctopus's user avatar
  • 3,216
4 votes

Extension to edit multiple articles in a same pattern?

Actually you said it - you need to change the content in the database. For doing such thing from within Joomla, Regular Labs DB Replacer Pro is the tool to use. Supporting regex searches, will allow ...
FFrewin's user avatar
  • 19.6k
4 votes

Why my custom query only returns one result?

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 ...
itoctopus's user avatar
  • 3,216
4 votes

How to check if specific table names exist in a database?

What is likely to be tripping you up is that your $tableArray doesn't have prefixes. This is evident in your query because you prepend the tablename with #__ in the FROM clause. The resultset will ...
mickmackusa's user avatar
  • 4,781
4 votes
Accepted

How to separate database results into 2 columns?

Using array_chunk() with the row count cut in half then rounded-up will ensure that the second column always has equal or one less row than the first column. HTML tables should only be used to ...
mickmackusa's user avatar
  • 4,781
4 votes

Joomla 4 Smart Search: Extra database for indexing data

Some big sites use external indexing software / services to index and search their site. Some are available as Software as a Service, while others can be installed on your own resources. For Joomla 4 ...
pe7er's user avatar
  • 1,948
4 votes

Migrating custom module to Joomla 4

Lodder's answer is fully valid, however he did not want to waste time to reformulate the query part of this old script in the question. As a morning drill during my coffee time I corrected that part ...
Zollie's user avatar
  • 2,896
3 votes

Joomla assets table ucm rows

The #__ucm_content database table is used to store tags for core extensions, so I would not remove them, else you may get an error along the line in the future. See more information tags with ...
Lodder's user avatar
  • 26.8k
3 votes

Query database for articles, filtering by tag

You could Join the #__content table with the one of the #__contentitem_tag_map, which is the table that stores the many-to-many relationships among the various content items and the tags: $query->...
FFrewin's user avatar
  • 19.6k
3 votes

Joomla Debug Console does not show Database Queries

This is kinda of necroposting, but an issue still has no fix from Falang author, so here is it. In the file ./plugins/system/falangdriver/falangdriver.php Find (309 row for Falang 2.6.0): $db->...
Shader's user avatar
  • 31
3 votes
Accepted

Joomla Debug Console does not show Database Queries

Found out that the joomla database driver is being overridden by another one which belongs to Falang component that allows you to manage all the content translations. Falang database driver has no ...
Aung Myo Linn's user avatar
3 votes

How can I get the names of the columns in an object or table with Joomla's SQL?

To get all columns of a table as arrays use JDatabase class method as follows: $db=JFactory::getDBO(); $columnArr=$db->getTableColumns("#__table_name"); foreach ($columnArr as $key => $value) { ...
Pratyush's user avatar
  • 496
3 votes

How to share table between 2 or more databases?

Yes, you can share the users from one Joomla! site to multiple other Joomla! sites (as long as you keep them on the same J! version). This is how you do it in Joomla! 2.5 - 3.6 (current version): ...
Michael Yaeger's user avatar
3 votes

Website for Famous People Profile Database

From my experiences, extending from an available component can be difficult to maintain in the long run. And extending from the component could be a hassle as the coding style are different and ...
Norman's user avatar
  • 131
3 votes

Are there any alternatives to Fabrik for building a database application (ERM/CRM)?

I've used Fabrik for a few projects in the past but for my most recent project I ended up using ChronoForms. I've used ChronoForms in the past but until recently didn't realize that it's capable of ...
Insider Pro's user avatar
3 votes
Accepted

How to create bulk articles by using php script?

I also faced the similar issue once and I modified the code as following which worked for me. You also need to pass the access and metadata in the article parameters. $article_data = array( 'id' =...
Liz.'s user avatar
  • 1,375

Only top scored, non community-wiki answers of a minimum length are eligible