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
2
votes
2answers
178 views

How can I translate SQL code into something that Joomla will take?

I am in the same case discussed on https://stackoverflow.com/questions/11709043/mysql-update-column-with-value-from-another-table, that is, I need to copy the value of a column from tableA to tableB ...
1
vote
1answer
33 views

Problem accessing database from front end of a component

I am currently working on a component which will display "events", stored in a database, on a map (filterable by location, category, date etc...). My first step is to display a simple report of the ...
1
vote
1answer
16 views

Custom Field Tag Style List

Joomla 3.9.11 I have created an SQL custom field for my joomla contacts called location, this allows me to assign a location to my contacts. The SQL simply selects location_name from a custom db ...
0
votes
1answer
54 views

Joomla / PHPMyAdmin bug when “select” is in the value

This question was originally asked on StackExchange, and it was recommended by @mickmackusa that I ask it here. Background We recently changed over from one server to a brand new one. Old server: ...
0
votes
1answer
47 views

Select Query With Integer and Quotes Fails

Joomla 3.9.13 I'm having some issues with a simple select query. This query is generated by the core files, I haven't created any overrides or changed the code. In administrator/components/...
0
votes
2answers
212 views

How to get Custom Fields related to Joomla Content?

I want to know how they get the values of custom user fields within Joomla articles. This is to contribute ideas and ways to solve it.
0
votes
2answers
106 views

Custom Component - Copy / Archive record when values change

For a custom component, I want to incorporate a way of keeping track of changes made to records in specific tables. For example, when the mileage value of a car is changed, the record having the old ...
1
vote
2answers
2k views

MySQLi PHP Warning [closed]

I am getting the following errors (in this order) thousands of times in my error log: [08-Jun-2016 13:11:05 America/Detroit] PHP Warning: mysqli::stat(): Couldn't fetch mysqli in {...}/libraries/...
0
votes
0answers
57 views

Code works properly but shows data for all users

I am using the latest RS Form Pro with Joomla 3.9, Platform 13.1.0. My code is working properly (thank you guys!) But the data should be limited to each user. The user ID is is not in the table ...
0
votes
2answers
47 views

Jooma Article content to load from mysql based on ID in url?

On my old website, built in php i had a link on a page, wich picked an ID based on what line it was. <td width=124><a href="tp/package.php?ID=<?php echo $row[0];?>">Package</a>...
1
vote
1answer
31 views

How to match database values regardless of accents on letters?

With the following LIKE condition in my WHERE clause, I only get the exact match. . ' LIKE '. $db->quote($db->escape($artist)), 'AND') . When $artist is, for example Beyoncé, it only returns a ...
1
vote
2answers
631 views

Use one pdo connection across multiple modules?

I have multiple modules on the same page that are individually connecting to the same external database through pdo connections. The website is getting slower since I added more modules. My guess is ...
1
vote
2answers
38 views

Trying to display mysql values properly in php

I am trying to display my commissions for each month. I want to display all 12 months with a total for each month. I've started with just January but this is as close as I have come to get to what I ...
1
vote
1answer
114 views

Delete query and left join with JDatabaseQuery doesn't work

I'm trying to convert a delete query with left join to use JDatabaseQuery, but I am encountering an issue in the query. The query that I'm trying to convert and which works is the following : $db->...
0
votes
1answer
78 views

Random token in DB on each login

I'm looking to somehow add a "token" on login and temperately store it in the database (same as table *_users) until next login (important). I have a game of sorts that uses a selected user and ...
0
votes
0answers
43 views

Joomla 3.9.13 - Error: Failed to start application

I just installed version 3.9 joomla in local using xampp. Once the installation was finished correctly I tried to navigate the site and the backend. After loading a few pages, this annoying error ...
1
vote
2answers
274 views

UPDATE query to add 1 to multiple columns

I have a website for my football team. I have some statistics and so on in there, for example how many games each player has played and so on. What I would like, is for me to write in the names of ...
0
votes
1answer
116 views

Convert from MySQL query using SUBSTRING_INDEX into Joomla API query?

I have a query which gets the information that I want using SUBSTRING_INDEX in MySQL. I am trying to convert this to use the Joomla query building syntax, but I am not sure how it should be formatted? ...
3
votes
2answers
1k views

How to Use IN Clause in Joomla Query

I am trying to select records where a column is in a suggested list if values using the IN clause. I have tried the query below but the system is not working. $db = JFactory::getDbo(); $...
1
vote
1answer
49 views

How to collect multi-row data from #__fields_values and assign specific aliases for each value in the result set?

I have the following (working) query to get name, username and the value of a custom field: // Get a db connection. $db = JFactory::getDbo(); // Create a new query object. $query = $db->getQuery(...
2
votes
3answers
257 views

Joomla 3.3.6 Union SQL Issue

I am having trouble using the union functions in Joomla. This is the SQL I need: SELECT * FROM (SELECT o.title AS org_name, u1.name AS username, 'president' AS `type` FROM ...
1
vote
2answers
66 views

How to re-write sql for joomla JDatabase

I am new to custom Joomla coding so excuse me for this, I want to execute the following statement: "SELECT MAX(CASE WHEN v.FieldName = 'Team_Name' THEN v.FieldValue END) 'Team_Name' , MAX(...
2
votes
2answers
226 views

How to retrieve RSForm submission data grouped by SubmissionId?

I have a table with 3 columns: SubmissionId, FieldName and FieldValue. 1) SubmissionId keeps ID submission. 2) FieldName stores field name of a form. 3) FieldValue stores field value of form field. ...
1
vote
2answers
191 views

How to refactor two select queries on RSForm submission data?

I was wondering if anyone could help me JOIN multiple queries into one query. Currently, these 2 blocks of code retrieve information from the DB. I am using the "Sourcerer" plugin to add custom PHP ...
2
votes
2answers
236 views

How to combine several sets of 'ANDs' and 'ORs' in a complex WHERE query object?

I want to create a complex WHERE query that checks: If (condition1 = TRUE) AND (condition2 = TRUE) AND (condition3 = TRUE OR condition4 = TRUE) So the first two conditions MUST always be true and ...
1
vote
1answer
270 views

MySQL SELECT query with LIMIT to show a maximum of 3 images

I want to show up to 3 images that are assigned to the logged in user in a database table. I have written the following MySQL query: $db = JFactory::getDBO(); //GET GALLEERY IMAGES $query ...
0
votes
1answer
36 views

Joomla 3 database query select with limit [duplicate]

How can I use this query with joomla 3 with limit to 3 SELECT * , (3956 * 2 * ASIN(SQRT( POWER(SIN(( $coorlat - latitude) * pi()/180 / 2), 2) +COS( $coorlat * pi()/180) * COS(latitude * pi()/180) * ...
3
votes
3answers
128 views

Is there a file that defines error messages?

I would like to catch some exceptions to inspect the error code and determine if I should re-throw it with a more user friendly message. This would probably be most beneficial with MySQL errors. Is ...
1
vote
1answer
51 views

Raw sql query returns multiple rows, but with Joomla methods only one row is returned

For some reason the query I put directly to DB works, but when set in Joomla syntax it is returning only 1 result, and there should be a lot more... Clear Mysql query: SELECT vmp....
2
votes
1answer
66 views

Issues to be aware of when calling `concatenate()`, `regexp()`, `rand()`, and `castAsChar()` in sql queries

I'm taking it upon myself to become aware of some of the lesser known/used query methods because I like toying with MySQL and I want to implement Joomla calls when possible/sensible -- because they ...
1
vote
1answer
73 views

How to query for users from a specific user group?

I want to list only the users with a group_id value of 10. Why doesn't the following query work? $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('a.id, a.name, a....
1
vote
2answers
486 views

Selecting data from 2 tables and inserting into a 3rd table

Could someone help me to create a query using the Joomla API? I've been going round in circles. What I have so far: <?php // Get a db connection. $db = JFactory::getDbo(); // Create a new query ...
3
votes
2answers
443 views

How to sort my query's results by publish_up value?

I have a .php script that retrieve fields from my database table and then displays them in a foreach loop (here are the relevant parts of the code): <?php $jquery1 = "SELECT `...
0
votes
0answers
32 views

Joomla! extensions table is not unique

The Joomla! extensions table is not editable in PHPMyAdmin. I believe there are non-unique values there too, so it cannot have an index. This is wreaking havoc with my install, I can't add any new ...
0
votes
3answers
1k views

Reformat DATETIME type value to European date format

I have a select query which returns a DATETIME value (stored format: YYYY-MM-DD HH:MM:SS). I want to show this on my site in "Euro date format" in other words d-m-y format. So what sql code should ...
0
votes
1answer
49 views

How to write a DELETE query with WHERE conditions using JDatabaseQuery syntax?

I have a query which I am trying to convert to JDatabaseQuery syntax, but I'm not able to find the correct way. The query is the following: DELETE upt FROM #__mycomponent_user_posts AS upt WHERE upt....
0
votes
2answers
637 views

How to make a mysqli connection and execute a SELECT query in Joomla?

I am having an issue with a basic query in PHP. The query runs perfectly in PHPMyAdmin, but in the browser I am getting: Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, ...
1
vote
1answer
40 views

JCE convert unicode after save in my DB

I added &#128274; in the source code of JCE. JCE convert it to 🔒. The problem is after save in my database ist is a scratch characters 🔒. My question now is should I modyfy JCE (How?) or ...
0
votes
0answers
17 views

idx_XXX error after reimport from content table

I export only the xxx_content table from SQL with TRUNCATE. After reimport the table the follow error message comes: ALTER TABLE `XXX_content` ADD PRIMARY KEY (`id`), ADD KEY `idx_access` (`access`...
3
votes
4answers
869 views

How to retrieve unique values before a parenthesis in JFormFieldList Filter query?

I have a JHtml custom filter populated by a JFormField extended class. It is added in the view with the following code: JHtmlSidebar::addFilter( '- Select Height -', 'filter_height', ...
1
vote
4answers
2k views

Display a Value from a Specific DB Field

I'm trying to figure out what I've got going on here thats not working - I'm using RsTicketsPro and I'm trying to pull a specific value from their custom fields section in the database. I reached out ...
2
votes
2answers
1k views

Joomla 2.5, how to use “HAVING” using Query Object

"SELECT *, ((ACOS(SIN($lat * PI() / 180) * SIN(latitude * PI() / 180) + COS(78 * PI() / 180) * COS(latitude * PI() / 180) * COS((87 - longitude) * PI() / 180)) * 180 / PI()) * 60 * 1.1515) AS distance ...
0
votes
0answers
2k views

Error: Out of sort memory, consider increasing server sort buffer size

I have upgraded the joomla website to 3.5.1 and the module manager is showing error: Out of sort memory, consider increasing server sort buffer size SQL= SELECT a.id, a.title, a.note, a....
1
vote
1answer
2k views

Error loading module MySQL server has gone away

I am facing a serious issue with Joomla version 1.7. MySQL server has gone away I am using the shopping cart platform Virtuemart. When I placed an order, the order confirmation message page is ...
1
vote
2answers
65 views

Filtering product query with two sets of filters. (J2Store)

I have two disjointed sets of product filters, $special_filters and $other_filters. I'm trying to retrieve the products from the database which match any of the filters in $special_filters AND any of ...
0
votes
1answer
92 views

How to sort a fabricated column in my view that I've stitched together with data from multiple columns?

I have a view that displays a list of data from a table (I'm targeting Joomla! 3.5+). However, I fabricated a column that stitches data together after some manipulation. I do this in the getItems() ...
1
vote
2answers
134 views

How to refactor my iterated sequence of queries?

I'm building a component which is about to be finalized, but there is a bit of code that I want to refactor. I think this code can be completed in one statement and I used more than 3 statements. $db ...
1
vote
1answer
60 views

How to integrate my custom Administrator component with core Joomla database tables during install?

Background: I am starting to package up three associated custom Joomla extensions that I've developed. (This is directly associated with my previous JSE question, if you want more context.) The ...
31
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 ...
5
votes
1answer
594 views

K2 Add tag to article if the keyword is in the article title

This seems to be a bit out of my league and knowledge of MySQL. So if someone can help it would be much appreciated. I would like to do the following: Enter/define a keyword e.g. mercedes Find all ...

1 2 3 4 5