Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [sql]

Structured Query Language (SQL) is a language for querying databases.

3
votes
1answer
32 views

(RuntimeException $e) vs (JDatabaseExceptionExecuting $e) for SQL exception handling

Through out the current version of Joomla (3.9.6) I find a mixture of ways that SQL exceptions are handled and I was wondering if anyone could give me some definitive situations where one should be ...
1
vote
1answer
40 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 ...
0
votes
1answer
46 views

Use the “sql” form field type in extension xml only if the table exists

I developed a plugin for Joomla!, and I have the below sql parameter field in my sampleplugin.xml <field name="cb_fields" type="sql" label="Select CB fields" query="SELECT name ...
0
votes
1answer
37 views

Bulk delete disabled k2 users Joomla 2.5

I have thousands of spam users. I use K2 and I would want to delete them from "k2_users" and from "users". I want to delete the blocked ones. I have tried deleting K2_users from the admin, but it does ...
0
votes
2answers
51 views

Ordering Joomla menus in code

I am trying to order jos_menu items by the order in which they appear on the menu. In other words, I am using jdatabase sql queries to fetch menu objects then iterate through them to display them. I ...
1
vote
1answer
93 views

How to construct a JOIN query with Joomla's query methods?

I'm really new to SQL queries but now stuck with this one. I need the first and last name of a user from table #__comprofiler where their cb_job_role = 'Team Leader' and their cb_service_name = [the ...
2
votes
2answers
107 views

How to query certain rows from a table based on other associated rows in the same table?

I'm trying to query my jos_rsform_submission_values table for FieldValue data in rows with a FieldName of Container# which shares a SubmissionId with another row where the FieldValue is "Pending" and ...
2
votes
3answers
62 views

Confusion about using two select() method calls in one query

I am using Joomla's JDatabaseQuery methods to select some columns from two joined tables, but I don't understand something about the following snippet. //Initialize variables. $db = JFactory::getDbo()...
1
vote
1answer
124 views

Delete row from custom made SQL when deleting article in Joomla

I´m still new to Joomla and to coding SQL. I was thinking about how I should manage a big system I made with information that is saved in a sql table, that contains some user input and the "id" of an ...
0
votes
3answers
85 views

Convert PHP code to Jooma PHP syntax?

I'm running a query on phpmyadmin which has the "IN" function included. It is to extract data from the same column for different fields' (Waybill1, Waybill2 etc.) I shall post the SQL query below: ...
2
votes
2answers
46 views

What does sql_select=“e.*” do?

On https://docs.joomla.org/SQL_form_field_type it talks about using the SQL fields. I'm wondering what sql_select="e.*" does. I know that the star is a wildcard for everything. I'm just not sure ...
1
vote
2answers
48 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
1answer
74 views

Joomla Migrating Live Site To Localhost -Navigation Not Working

I just migrated a Joomla site from live to localhost. Have the front end up and can access the backend without problem. Front end wise none of the menu items work. I have renamed the live site ...
1
vote
1answer
121 views

Error when populating a database table while installing a module

I am using the following code for creating tables in my .sql file as part of a module. CREATE TABLE IF NOT EXISTS `#__gruposlocales` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(...
0
votes
1answer
240 views

How to SET a user-defined MySQL variable and increment it to produce ranking values with JDatabaseQuery?

I'm trying to write this query: SET @rownumber = 0; UPDATE #__hikers SET rank = (@rownumber:=@rownumber+1) ORDER BY score DESC; like JDatabaseQuery, but still got an error. Please help UPDATE: I ...
1
vote
1answer
135 views

How to select records one by one using JDatabaseQuery

In programming languages there are 2 patterns for selecting records from the database: //prepare SELECT statement while($record = $query->fetchRow()) { //do the job } And the second: //...
1
vote
1answer
53 views

Join two similar table SQL [closed]

In database it shows: -Table 1 data show discount_category_id as: 1 2 3 -Table 2 data show category_id as: ,1, ,2, ,3, So is anything wrong or any syntax error with my code because i tried print_r ...
1
vote
2answers
73 views

Rewriting code as per Joomla guide, but page showing 404 error

I am rewriting some old code according to the latest reference, although the page description is coming out correctly in the old code. But when rewritten into new code, the page is redirecting to ...
0
votes
1answer
133 views

Join two list views without a shared key

I have a front end list view for a table called #_students and a separate front end list view for a table called #_sessions. The two tables have no shared foreign key and the two data sets are ...
0
votes
1answer
271 views

Error: Incorrect table definition; there can be only one auto column and it must be defined as a key

I am trying to install joomla 3.7.5. I am facing an Error message: Error: Incorrect table definition; there can be only one auto column and it must be defined as a key The table '#...
1
vote
1answer
235 views

Retrieve article URL from phpMyAdmin

I am migrating a site from Joomla to WordPress. The migration tool didn't setup redirects for the old urls so I'm planning to write something to do them for me. I need a way to output all the current ...
-1
votes
1answer
53 views

add text after value that is retrieving from SQL in php [closed]

This is the code that i retrieve data from sql in this case ¨Km¨ is added before value but i will ¨Km¨ after value .. example : now is like this : Km 129.000 but i will 129.000 km $insert1 =" /// ...
1
vote
1answer
133 views

Run Stored Procedure From Page Load

I have a html table that has a hyperlink in it, when the hyperlink is pressed 3 parameters are passed to a secondary page. The query that is run is a CTE SQL Server statement, and from my ...
2
votes
2answers
137 views

Transfer Joomla data from PHPMyAdmin SQL Dump

My friend's web page was created with Joomla (c. 2013), and she wants to transfer her site to a new host. Her current host sent her a SQL Dump generated by PHPMyAdmin, which contains what I assume is ...
1
vote
1answer
73 views

Adding a stand alone php (with sql queries built using mysql phpgenerator) to existing Joomla application

I am totally new to Joomla development in specific but have done good old prog days (C, Oracle, Sybase etc). So i use a Library software in Joomla and do all the installation, admin etc thing.. i want ...
0
votes
1answer
370 views

Joomla 3x sql field NOT Filtering on Change

I am using Joomla 3x sql field to filter between two select fields.. The problem is that the second field does not filter as expected. It is just populated with all the result and when I select a ...
0
votes
1answer
171 views

Dynamic component SQL parameter type

I'm looking to add a Component field which will display a list of Joomla users who have a relationship with current the Component item. Below is some sample XML where by I would like [current ...
5
votes
1answer
236 views

Joomla 3.6 How to migrate data from repeatable to subform

The new field type subform does not retrieve old data repeatable, even fields have the same names. I created many posts with repeatable. The data are stored in extra fields of com_conent. attribs ...
1
vote
4answers
11k views

The MySQL adapter mysqli is not available - how to resolve this issue?

My website www.EliteMaths.com.au has been active until early this week. When I tried to access it this morning I got the following error message: Error displaying the error page: Application ...
2
votes
2answers
153 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. ...
0
votes
1answer
311 views

Copy user data into custom table on user registration

upon creating a user in joomla i would need fields copied from jmla_users table to another jmla_new_users. jml_users - jmla_new_users with the following fields, (username,firstname,lastname,email) ...
0
votes
2answers
386 views

Joomla 3.4.8 Component SQL Update Not Working

As the title says I'm using joomla 3.4.8 I'm trying to customize the system component "com_content" what I want to do is to add an another columns on the '#__content" table in the database but the ...
0
votes
1answer
185 views

joomla 2.5 / K2 - SQL Query to delete trashed items taking care of data integrity

I have not a testing environment where put this to the test: delete from k2_items where trash = 1 Of course this will remove everything that is marked as trash, but is there any other table that has ...
1
vote
2answers
193 views

getting some sql error

I have recently restored my joomla website and it was working perfectly fine, but suddenly I am receiving the following error: 1064 : You have an error in your SQL syntax; check the manual that ...
4
votes
3answers
770 views

How to rewrite SQL-query with CASE/WHEN to Joomla-based “format”

I have the following SQL-query to database: $jinput = JFactory::getApplication()->input; $category_id = $jinput->get('virtuemart_category_id'); $db = JFactory::getDBO(); $query = $db->...
0
votes
2answers
99 views

Do I need a custom field for a db field alias?

When viewing an individual record, I'm using a calculated field from a sql query to display as a read only field in my form. However I'm unable to get it to display (no error, just blank). Curious, do ...
0
votes
1answer
468 views

Update all rows primary key columnin a table - Joomla 3.4.8

I have a temp table created with a list of "master tasks". These need to be duplicated so they can be assigned to users as needed. The problem I have is the table column 'id' is a primary key set to ...
3
votes
4answers
582 views

How to only transfer new column values from one table to another?

I'm attempting to create a new table: _clients that will be simply populated with, for now, with the user_id column from #__user_usergroup_map. Ideally, the below code should pull all id's from #...
1
vote
3answers
39 views

Trying to set up new joomla from old joomla files

So basically my Joomla site was attacked a few weeks ago by SQL injection and was taken down. What I am hoping to do, is to go into the file manager and download all of my articles, categories, ...
1
vote
2answers
612 views

After Joomla update duplicate or create new module get id : 0

Joomla is updated to 3.3 and create of a new module or duplicate existing module with no success. Its possible to create a new, or duplicate modules but module id is 0 for each new module I create, ...
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 ...
3
votes
2answers
708 views

JDatabase JOIN on multiple values

What is the JDatabase syntax for a JOIN statement that joins two tables on a variable that is either equal to x or is null? Eg it joins on multiple values. I have found some examples that show me you ...
0
votes
2answers
642 views

Get current language and DB Query to select content by language

I'm trying to select data from content table in Joomla (3.4) filtered by language field. When I pass a value, it doesn't change in the SQL statement Here is my code: public function articlesar() { ...
3
votes
4answers
2k views

How to write my MySQL query with JOIN logic using JDatabase methods?

I'm having a difficult time translating this SQL script to JDatabase methods because I can't find the AND query method. SELECT user.firstname, user.lastname, leadership.leadname, leadership.lead_des ...
1
vote
3answers
1k views

Retrieving multiple results from the database

I don't have much Joomla or PHP experience so I'm probably missing something really simple. I'm trying to load a certain list of user IDs into an array. This code works except it only loads one result....
4
votes
2answers
374 views

Join an existing table with a generated table of dates and count rows for each date?

I would like to use this complex mysql query in my joomla model to generate a timeline and count entries within a specific date range. My SQL Query is: SELECT T.calendar, COUNT(DATE(M.date)) as ...
0
votes
1answer
953 views

Use different mysql table for users

I need to integrate a users table instead of the default Joomla _user table. The table pref_users has simple id/user/email/password fields (not hashed). Is there anyway I can make Joomla use it ...
0
votes
1answer
388 views

Joomla MVC Component: Run SQL before deleting record

I have a course listing component, and each course as zero, one, or more corresponding sections for that course. Basically different versions of that course that run at different times at different ...
0
votes
1answer
310 views

How to merge joomla tag using SQL query from phpMyadmin?

Since Joomla does not have a tag merging feature, I'm looking for a way to merge existing tags using SQL query in phpmyadmin. Old tag_id=1 New tag_id=2 This query works as long as all of the ...
1
vote
2answers
444 views

Extension install scripts without raw sql

I am new to Joomla development, coming from Magento. Working through the tutorials with a certain extension in mind I stumbled upon a little problem. By now Joomla supports MySql and MSSQL and more ...