Questions tagged [database]

A database is an organized collection of data typically used to model certain situations. Use this tag if you have questions about designing a database. If it is about a particular database management system, (e.g., MySQL), please use that tag instead.

Filter by
Sorted by
Tagged with
32
votes
4answers
4k views

Method for creating a subquery using JDatabase

At http://docs.joomla.org/Selecting_data_using_JDatabase, there isn't a documented method for writing a subquery using JDatabase. https://gist.github.com/gunjanpatel/8663333 exemplifies one way of ...
16
votes
6answers
25k views

How can I print out a Joomla query?

Suppose you have constructed a query with Joomla. // Get a db connection. $db = JFactory::getDbo(); // Create a new query object. $query = $db->getQuery(true); // Select all records from the ...
13
votes
2answers
2k views

How can I programmatically get the Joomla database prefix using php?

I sometimes access the Joomla DB via external scripts. The problem I have is that if I ever need to change the prefix, I'll need to edit my scripts again too. Is there a way to programmatically ...
11
votes
1answer
11k views

Can I use PostgreSQL with Joomla 3.3

Can I use PostgreSQL with Joomla a 3.3 production site (not for testing) and if so is there anything I should be aware of? I would appreciate some feedback from someone who has actual installed and ...
11
votes
2answers
10k views

Catching exception/error in database transaction

I am using the following way in joomla 2.5 and 3 to execute database query - $database = JFactory::getDBO(); $database->setQuery $database->execute(); but how do I catch errors/exceptions if ...
10
votes
1answer
326 views

Migrate meta keywords to tags

Is there an easy way to migrate or copy existing meta keywords for articles so that they become article tags, in Joomla 3.6? The situation is: Joomla, until a few versions ago, didn't have a tag ...
9
votes
1answer
2k views

Making Custom HTML User Profile Page by using Joomla Variables

I guess its going to be complicated but i will try my best to make you understand, what i want to achieve. All i want, is to make a custom HTML page, which will show the information of the user who ...
7
votes
2answers
518 views

Recommended practices regarding transfering database from Joomla 1.5 to Joomla 3

I want to transfer about 300 articles from a Joomla 1.5 website to a Joomla 3.3.1 website. I have access only to the Joomla 1.5 database but not to the backend (I have access to both for the joomla ...
7
votes
2answers
112 views

Options for backups, restoring, and staging?

What are some options for Backing Up & Restoring Joomla! instances? Preferably ones suitable for staging.
6
votes
1answer
802 views

Database query where() value is a number

As we know, any values that are defined in a database query should always be escaped in Joomla using $db->quote($value). When defining numbers as a variable, one would normally use (int) to set ...
5
votes
2answers
4k views

How to do SQL exception / error handling compatible with 2.5 and 3.x?

I was trying to develop Joomla 2.5 and 3 component. As many things deprecated between these two versions and the way to throw and catch database and other errors, I could not find ways yet to make ...
5
votes
1answer
3k views

Query database for articles, filtering by tag

I can use this to get published articles from the database: function queryDatabase_Posts($select, $limit) { // Database connection and query object. $db = JFactory::getDbo(); $query = $db-...
5
votes
2answers
953 views

JForm with custom SQL statements

I have a JForm, which inserts records in the database and relies on its own controller, model, view and table, derived by JTable. However, the database table contains one special field representing ...
5
votes
2answers
2k views

Joomla MVC Component File upload w/ Database field update

So I find this a little weird because the DB field was updating without much effort on my part, until I started writing in file upload functionality. Now the database doesn't seem to be updating, but ...
5
votes
1answer
753 views

Joomla SQL drivers and prepared statements

Can you tell me if Joomla SQL drivers support prepared statements? As far as I understand, the MySQLi driver does not prepare SQL statements. But Joomla also supports MySQL PDO driver. Does this ...
4
votes
4answers
2k views

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

I'm running Joomla 3.9.5 and I'm attempting to update my JFactory::getDbo() calls (which are deprecated) to the newer format using the container. However, I'm getting the following error: Call to ...
4
votes
3answers
3k views

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

With the existing output I have from a basic query, what would be the best way to get the names of the columns in the resultant output object without having to run an additional COLUMNS query on the ...
4
votes
2answers
411 views

Using Separate Databases for Each Component

My client is a Data Center Architect. Due to his experience with his work (many customers come to him because they have suffered great data loss in the past), he would like me to configure his ...
4
votes
5answers
5k views

MySQL error: Unknown storage engine 'InnoDB'

I have a couple of Joomla 3.3.6 websites, and suddenly this morning I started to get random error messages, like this: Error displaying the error page: Application Instantiation Error: Unknown ...
4
votes
1answer
979 views

Table marked as crashed and repair failed

My Joomla 1.5.16 website has started to display the error below. I don't think this is a hack, and I can't find any evidence in the logs of someone trying to get in or any changes to files that ...
4
votes
1answer
89 views

Create a table observer

I am trying to create a table observer in a module. I am using the Table Advanced API guide in the Joomla documentation https://docs.joomla.org/Table_Advanced_API_Guide. When I use the code provided, ...
4
votes
2answers
2k views

Migrate users account from Joomla 3 to another Joomla 3 manually

I'm trying to migrate Joomla 3 user's information to another Joomla 3 installation. From PHPMyAdmin I exported _users table and _user_usergroup_map to the new Database. The users appear in the user ...
4
votes
2answers
3k views

Creating a module to search the database and display the results

I have got a table in the database called #__magazines, this holds data for magazines (date published, issue number etc..). I have created a Component, Plugin and Module which is for Joomla 3.x, I ...
3
votes
2answers
2k views

Adding Multiple Users in Joomla

How can to add multiple users in Joomla 3 without using an extension? Thank you! :)
3
votes
2answers
565 views

Joomla Debug Console does not show Database Queries

My Joomla 3.4.4 website is not showing Database Queries in Joomla Debug Console at the site front-end but it can be seen at the Administrator back-end. Below is the screenshot at the front-end And ...
3
votes
2answers
2k views

Check if INSERT query was successful or failed because of a duplicate UNIQUE KEY

I have a db-table called league where the mail column is the unique id: |name |mail | |Bryan|bryan@hotmail.com | I have a frontend where users can sign up and then I have this for ...
3
votes
3answers
1k views

Insert into database with ajax from a joomla 3 module

I have seen a lot of inquiries about ajax, but normally there are about retrieving data from database. I was wondering about how to insert data directly interacting inside a module. I have a module ...
3
votes
1answer
131 views

How to separate database results into 2 columns?

I saw the examples of how to do the odd even way, but I want the order to flow from one whole column to the next and not alternating left to right for each alphabetical item. Can this be done? Here ...
3
votes
1answer
938 views

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

With latest joomla version I try to achieve one query to the database and updating multiple rows at once. I want to make a query like this: INSERT INTO `tablename` (`id`,`date`) VALUES ('79','2018-...
3
votes
2answers
442 views

A foreign key field not updating as NULL

I am having a field 'leavepack_id' in a table with the below table definition CREATE TABLE IF NOT EXISTS `#__position` ( `position_id` int(11) NOT NULL AUTO_INCREMENT, `leavepack_id` int(9) ...
3
votes
2answers
957 views

How to share table between 2 or more databases?

I have a Joomla! site and now I want to make some subdomains. But, I want that the users must be the same in both. Like, if a user logs on to the main site and then goes to the subdomain at the same ...
3
votes
1answer
1k views

How can I increase the maximum length of article titles?

I need to create a few articles with very long titles, but it seems like Joomla has a maximum article title length of around 256. How can I increase this limit?
3
votes
2answers
494 views

How to prevent Joomla from reporting database error information

I'm currently investigating SQL injection attack vectors in my application. Currently, Joomla is reporting database error output when returning a HTTP 500 error page. How do I prevent this? The ...
3
votes
2answers
51 views

Clean up a WIP site before launch

I've been working on my own template for work, and in the progress made different temporary articles, categories and menu names. For the launch I'd like to clean it up as much as possible, resetting ...
3
votes
2answers
2k views

How to save image in specified folder in joomla directory and save file name in db

I am working on a custom component, where at the backend interface - we want the admin user to be able to upload image and let that image directly save to a specified folder - /images/uploads/variants/...
3
votes
2answers
668 views

Joomla assets table ucm rows

Does anyone know what these rows are for? Is it safe to remove them? Since they seem to be mostly empty? Note: this is assets table!
3
votes
2answers
113 views

What is the proper use of the name tag in the manifest file?

In the latest J!3.4 when installing extension of type 'file' (or may be other types are affected also) there is a difference regarding what is going into element field of table _extensions. Some ...
3
votes
1answer
808 views

Installing PostgreSQL database - Error connecting to PGSQL database

I try to install Joomla 3.3.1 on a new site, with PostgreSQL database. I did all correctly, and I tried many times, did lot of verifications, etc, and I have always the return : "Impossible de ...
3
votes
1answer
407 views

Delete all demo data

Many templates come with demonstration data that may be installed to show off the features of a template. Is there a simple method of deleting all this data or am I going to be forced to delete each ...
3
votes
1answer
1k views

Date or DateTime in database for Component Development using timezones?

Our component manages Television programming, so dates & times are critical - here's the scenario: Our server and most producers are all on local, Pacific Time (America/Los_Angeles, UTC+8) Joomla ...
3
votes
1answer
112 views

Using variables from a database like source

I have a google sheet (no, the data does not need to permanently reside there.) Which contains data for T-Shirts of my design Name Source Thumbnail Commision ...
3
votes
1answer
31 views

Is there a way to purge all content and maintain settings?

I need to purge huge amount of data from J but maintain settings / modules etc. I've tried to write cli tool to clean up tables using correct models, but it is taking too much time. Is there a simple ...
2
votes
2answers
3k views

How to save checkbox values in a table?

How can i insert data from a html form to a table in Joomla database. Sample code of the form: Name : <input type="textbox" name="username"> Selection1 : <input type="checkbox" name="choice1" ...
2
votes
2answers
859 views

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

All I want to do is check if a table exists or not and I can't figure it out. I've tried: for ($r = 0; $r < count($tableArray); $r++) { $db = JFactory::getDbo(); $query = $db->getQuery(...
2
votes
6answers
342 views

Database Error At Busy Times

My Joomla 3.6 website up time is pretty good, however at times of high traffic, my site shows a white page with the following text; Error displaying the error page: Application Instantiation Error: ...
2
votes
1answer
31 views

Restoring with Akeeba to a new site on cpanel

I've backed up my Joomla site with Akeeba, and I'm using Akeeba Kickstart to put the site into a dev environment on a different server with its own cpanel. The dev server has its own database and ...
2
votes
2answers
759 views

Change "Show page heading" param for every menu item

I've got a site with few hundreds menu items. I need to change one parameter in all of them. Right now in most of the pages "Show page heading" paremeter is set to "No". I need it to be set to "Use ...
2
votes
2answers
39 views

Get the template I'm currently editing

I'm developing a custom form field for my template and I need to know the name of this template from inside this form field. While otherwise I would do a setQuery to look for client_id=0 and home=&...
2
votes
1answer
919 views

What is Joomla article options stored table?

I am searching where in the database (table, column) are stored the choices we make at Option tab, when editing an article. To be more specific I was looking to see where is the "Show Author" (Show ...
2
votes
2answers
89 views

Query with INTERVAL won't work

I have the following query: $query->select('date') ->from('#__db_reports') ->where($db->quote('date < NOW() - INTERVAL 30 DAY')) $db->setQuery($...