Questions tagged [mysql]

MySQL is a database system used by many websites on the Internet. Joomla is based on PHP and MySQL.

Filter by
Sorted by
Tagged with
1 vote
1 answer
86 views

Standalone PHP script to get username in Joomla 4?

In Joomla 3 I used the following code. What do I need to change to use it with Joomla 4? <?php define( 'DS', DIRECTORY_SEPARATOR ); $rootFolder = explode(DS,dirname(__FILE__)); //current level ...
yowww23's user avatar
  • 11
2 votes
2 answers
66 views

Is insertObject sanitizing the inputs?

Let's suppose I want to insert a new record into a table. Let's suppose that the table is of the structure of mytable(id, my_text); So, for example, we are to insert a new record, I would like to ...
Lajos Arpad's user avatar
0 votes
1 answer
167 views

MySQL "LOAD DATA LOCAL INFILE" with database connection object in Joomla 4

In order to import large CSV files into a Joomla database table, I use the MySQL "LOAD DATA LOCAL INFILE" command as follows: $db = $this->getDbo(); $sql = "LOAD DATA LOCAL INFILE '&...
cappu's user avatar
  • 139
0 votes
0 answers
65 views

Multi-level Dependent Drop Down Lists by Joomla 4 SQL Custom Field

I need to create a Multi-level Dependent Drop Down List to show my Joomla Categories list in the first dropdown list and then show the related articles in the second dropdown list (based on the value ...
KEian's user avatar
  • 3
0 votes
1 answer
77 views

Using MySQL "LOAD DATA LOCAL INFILE" with the Joomla database connection object

In a Joomla 3 component I use the MySQL "LOAD DATA LOCAL INFILE" command to import large CSV files into a Joomla database table. When moving to a new server, it is no longer possible to ...
cappu's user avatar
  • 139
0 votes
2 answers
35 views

UNION Query with loadAssocList($key)

So here is a small example of the query I play around with: $db->setQuery('SELECT position, title FROM jos_modules UNION ( SELECT position, title FROM jos_modules )'); $data= $db->loadAssocList()...
maidan's user avatar
  • 383
1 vote
1 answer
164 views

Joomla 4.3.1 Web installer fails to find MariaDB (MySQL) or PostGreSQL 11

I am trying to install Joomla 4.3.1 on my Ubuntu 18.04 machine. I am running Apache 2.4.57, PHP 7.4 (for Apache, apparently), PHP 8.2 is also installed, and two installations of PostGreSQL: 10.4 (...
excyberlabber's user avatar
2 votes
3 answers
91 views

Find row with lowest column value per group, then join distinct group data to another table

I need a hint for this problem, trying for days already to solve it: THE PROBLEM I am working with an Joomla extension which has this 2 tables of interest: COMPANIES PRODUCTS A module lists all ...
Steven's user avatar
  • 35
1 vote
1 answer
86 views

How to combine or merge SQL results into one row

I have a Joomla list page that I am trying to build each row from multiple tables that I haven't been able to figure out how to do efficiently with MySQL and would like some assistance. I suspect the ...
Irata's user avatar
  • 3,597
1 vote
2 answers
114 views

How to use NOW() with DatabaseDriver->insertObject()

I'm inserting an object in a database table using joomla 4, as per joomla docs: $toInsert = new stdClass(); $toInsert->update_timestamp = 'NOW()'; $toInsert->id = null; $db = Factory::...
Jimmy's user avatar
  • 307
0 votes
0 answers
191 views

Connecting to an external database in Joomla 4 - further problem

I have seen the earlier question on this subject and tried the suggested code: $db = (new Joomla\Database\DatabaseFactory)->getDriver('mysqli', $options); but get an error: An error has occurred ...
johnonorvic's user avatar
1 vote
2 answers
62 views

Insert datetime type into created column from PHP file from module/component

I can't get the created column filled when inserting items into the database. I am using this code: function createRecordInLSFCDBTable($id, $userId) { echo 'createRecordInLSFCDBTable: ' . $id . ',...
purple11111's user avatar
0 votes
0 answers
116 views

Using Like with wildcard in joomla php query

Hi I am struggling to get an output from a wildcard query. I am using the following code which outputs the following error: 0 Unknown format specifier "$" $iban = '...
OnTarget's user avatar
1 vote
0 answers
48 views

workable php 7.4 function in joomla 3.10 is working weird in php 8.0

Am displaying list of news haviing Date News Heading Short Descrption The list is spread to around 100 pages, having 20 news in each page Issue is: This is working absolute fine in php 7.4.x in ...
Ruchika's user avatar
  • 415
2 votes
0 answers
60 views

Very slow HTTP response times possibly due to SEF rules in htaccess

Im running Joomla 3.X and can't seem to pinpoint why I'm getting such high HTTP response times. I think I narrowed it down to the SEF rules in my .htaccess I ran some tests and thought to post my ...
Nick's user avatar
  • 51
1 vote
1 answer
697 views

Connecting to an external database in Joomla 4

Connecting to an external database in Joomla 3 is easy following this documentation and works like a charm. But JDatabaseDriver->getInstance method is deprecated in Joomla 4. What is the ...
Peli's user avatar
  • 103
1 vote
1 answer
65 views

Mysqli query with regex to Joomla php syntax

// CODE1 (Mysql (MariaDB 10.8.3) query): SELECT s.`p_p`, COUNT(REGEXP_SUBSTR(r.`xml`, '[0-9]+')) FROM `#__s` AS s, `#__p` AS x, `#__v` AS r WHERE REGEXP_SUBSTR(r.`xml`, '[0-9]+') = [user_id] AND s.`...
GalanopD's user avatar
3 votes
2 answers
1k views

Joomla 4 create article programmatically

I have tried a few ways to create articles programmatically in Joomla 4, but none of my attempts are working. First is to insert data by mysql using $db->getQuery(true) -- the article shows in the ...
Na Nguyễn's user avatar
1 vote
1 answer
267 views

Joomla 4 - 503 service unavailable

I've set public $error_reporting = 'maximum'; public $debug = '1'; If I go into cPanel and turn off mysqlnd nd_mysqli and nd_pdo_mysql and then turn on mysqli I get an error MySQL server has gone ...
Eoin's user avatar
  • 1,889
0 votes
1 answer
267 views

Pulling api data and saving to mySQL

So, I am trying to pull data from EA Sports API for games like NHL or FIFA. The issues with EAs API is it only shows the last 5 games played. I am trying to have a script run every minute and save ...
Brandon's user avatar
  • 69
3 votes
1 answer
288 views

Is the following everything one should do to prevent SQL injection?

In order to sanitize the user input in an article insertion form (title and HTML content), here are the bits that I've included: Use of JInput: $jinput = JFactory::getApplication()->input; get ...
Vincenzo Oliva's user avatar
0 votes
1 answer
104 views

How to return data from 2 tables to one table using a select field

My tables: dzialki +--------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------------+-------------+------+---...
Dariusz Tokarz's user avatar
0 votes
1 answer
189 views

Implement SELECT query with a LEFT JOIN in J4

I want to get data from two tables using a LEFT JOIN. My query works in my current PHP code, I just don't know how to implement it with query building methods in J4. Can anyone help? SQL: SELECT `...
Dariusz Tokarz's user avatar
0 votes
0 answers
110 views

How to encrypt and decrypt User data in joomla

I am new to joomla, and working on joomla application which is currently running on production environment. Application contains 1000+ registered users. As per GDPR Policy, I have requirement for ...
Akoli's user avatar
  • 1
2 votes
0 answers
105 views

MySQL Server has gone away with mysqli_connect to another LAMP Stack / TURNKEY Linux

I am trying to connect to another VM (192.168.16.27) from 192.168.16.28 to get Data out of the MariaDB Database (joomla). So my Code is: $link = mysqli_connect("192.168.16.27", "user&...
alb's user avatar
  • 31
1 vote
1 answer
356 views

How to use Joomla for insert, delete, display and update data from mysql?

I'm just started to learn using Joomla and one of the things that I need to do is to build a form that can insert data and that data can be displayed to another Joomla page. I got a few comments from ...
random beco's user avatar
1 vote
1 answer
58 views

Joomla mysql query - group_contact

I have mysql query: // Get a db connection. $db = JFactory::getDbo(); // Create a new query object. $query = $db->getQuery(true); $formId = 21; $query = "select * from #...
Gocha's user avatar
  • 83
0 votes
2 answers
5k views

Error: Failed to start application: Failed to start the session

I have hosted web application develop using joomla in ubuntu 20 and use mysql as database. one i hosted and viewed in the web browser it show me Error: Failed to start application: Failed to start the ...
udakila's user avatar
2 votes
2 answers
568 views

How to join custom fields data to users table without extra rows in result set

I have rudimentary knowledge of SQL (when it comes to anything but single tables) and am trying to come up with a query that will give me all the custom fields for my users. This query will give me ...
Josef Zeevi's user avatar
0 votes
1 answer
343 views

How to create menu item in admin menu Joomla 4 in php+mysql in module, plugin?

How to create menu item in admin menu Joomla 4 in php? From plugin/module for Joomla4?
aleks_yolp's user avatar
1 vote
1 answer
54 views

PieChart For RSForm for PlotaLot based on a dropdown field

So I got this Pie Chart to display the Count of Voters vs Position and it's working fine. SELECT Position, COUNT(1) AS count FROM ( SELECT MAX(IF(FieldName = 'Position', FieldValue, NULL)) ...
Elaine Byene's user avatar
0 votes
1 answer
158 views

2014 Commands out of sync - MySql query J4

I've come across this error when performing some database queries in my J4 site model: $db->setQuery((string)$query); try { $rows = $db->loadObjectList(); } catch (...
Glenn Arkell's user avatar
1 vote
1 answer
106 views

GROUP BY and ORDER BY from different tables of CB extension as outcome to a list

I am trying to figure out how to implement this. Table1 with subscriptions AS sub id, status, user_id, plan_id, parent_plan, parent_subscription Table5 users (Joomla) AS u id Table6 fields AS ue ...
GalanopD's user avatar
1 vote
1 answer
282 views

View only showing one row from sql result set

I am creating a component and trying to display a list within a model. The code I have shows the multiple arrays that should be on the list, but when I add echo inside the view table, I am only ...
Brandon's user avatar
  • 69
1 vote
3 answers
268 views

Joomla 3.9 replace zero dates with null on save/checkin (mysql zero date deprecated)

So zero dates are deprecated in MySQL. J4 has replaced them with nulls.I am trying to update a J3 component to stop J setting zeros in the modified and checked_out_time fields. For modified I am using ...
RogerCO's user avatar
  • 51
1 vote
0 answers
47 views

Using sql field in custom component

I have a custom component, it allows admins to select a related content article from the #__content table using the following: <field name="relatedcontent" type="sql" default=&...
RustyJoomla's user avatar
  • 2,076
1 vote
1 answer
119 views

How can I get the names of the columns with their corresponding row values as a list to use in a field (select list) of a form in Joomla MySQL

My table '#__boats' is as follows: id category type AIG ALLIANZ LLOYDS 1 0 Motorboats 2 0 Sailingboats 3 0 Jet Ski ...
GalanopD's user avatar
0 votes
0 answers
250 views

How to display external SQL table using Joomla?

I am looking for good free extensions I could use to display SQL tables on my website. I have tried a couple but, they either don't work or ask for indexing which my tables don't have. https://joodb....
JShahi's user avatar
  • 7
1 vote
2 answers
191 views

How to use SQL statements not supported by JDatabaseQuery

Recently, I have needed to use some SQL statements that are not supported by the JDatabaseQuery class, specifically REPLACE INTO and INSERT IGNORE. The only way that I am able to get something to ...
Irata's user avatar
  • 3,597
0 votes
2 answers
65 views

Run model function in view file to insert default value into sql

I am new to Joomla and received a half-done component. It is a mostly database-dependent component. The component consists of a SQL file that inserts all the data and is able to display it. I am ...
Marcin Sypniewski's user avatar
1 vote
3 answers
327 views

Join #__content with #__fields_values then filter and sort using #__fields_values data

I wrote an override in Joomla 3.X and sorted the result from the DB using this query, which works: $query = "SELECT content.*, fieldvalues.* FROM #__content AS content, #...
Andreas Soraru's user avatar
1 vote
0 answers
26 views

MySQL - Is a query with many results or several queries with one result more efficient? [duplicate]

I need to get category titles for which I am using the a model where $result returns all the data from the categories table, what I need is only the titles, that by making a loop to $result and a ...
Leoalv's user avatar
  • 167
2 votes
1 answer
94 views

using Ajax to save contents of html how to make safe

I am using com_Ajax to save the contents of my editor (front end of the website in a module) Ajax and passing the content of the editor all works fine. I am concerned about security. To get the data (...
user1616338's user avatar
1 vote
1 answer
76 views

How to use Joomla's query building methods to generate a query containing joined subqueries? [closed]

I am trying to write a query using Joomla's query building methods, but I cannot manage to write the subquery into the query. Here is my desired raw sql with php variables: "SELECT track_type, ...
Azhar A's user avatar
  • 11
1 vote
2 answers
278 views

How to show multidimensional data in my CanvasJS chart?

<?php $db->setQuery("SELECT MartabehName, COUNT(MartabehCode) FROM `#__dimteacher` GROUP BY MartabehName"); $countMartabehName = $db->loadObjectList(); foreach($countMartabehName ...
saeed's user avatar
  • 43
1 vote
0 answers
41 views

Want to dynamically create users via database, how do I encrypt password?

I'm handling two websites a main one with a huge database and a secondary one, I want that when a user is created in the main one that it also creates it for the secondary one, I already connected the ...
Maximiliano Corbo's user avatar
0 votes
1 answer
95 views

How to conditionally add filters to my query of the rsform_submission_values table?

$FormId=23; $qustioan1=qka1; <form method="post" action="#"> <select name="state" onChange="irancitylist(this.value);"> <option ...
saeed's user avatar
  • 43
2 votes
1 answer
1k views

How to add pagination in joomla custom php code?

Please help me to add pagination (getLimitBox) to my table result. I have for example 100 rows in my table and I want to show 10 page. <?php $formid=23; $db = JFactory::getDbo(); $query = $db->...
saeed's user avatar
  • 43
1 vote
1 answer
142 views

RSFORM combine 2 submission form results in one Plotalot view

After requesting help from local db-masters with no result, I would like to ask this question here. The output required is this for example: Shelter ClientID Year Month Fees Amount ...
Gart's user avatar
  • 47
0 votes
1 answer
45 views

Logged in users not logged into Kunena on second site

I have 2 sites, let's call them site1 and site2. They're setup as subdomains such as: site1.domain.com and site2.domain.com They're both running Joomla 3.9.24 and I have created a view on site2 ...
RustyJoomla's user avatar
  • 2,076

1
2 3 4 5 6