Linked Questions
12 questions linked to/from SQL Injections using Jfactory::getDBO and setQuery() with LIKE condition
3
votes
2
answers
1k
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 ...
2
votes
1
answer
1k
views
JDatabase Like Operator
I would like to know how to perform pattern search using JDatabase
Here's my code:
$query->select('Common_name');
$query->from($db->quoteName('common_name'));
$query->where($db->...
2
votes
2
answers
563
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 ...
0
votes
3
answers
599
views
Joomla 3 call model function inside controller
I want to call a function from model inside controller
my model : httpdocs/components/com_storemanager/models/searchmanager.php
<?php
/**
* @version CVS: 1.0.2
* @package ...
2
votes
1
answer
421
views
How to count the rows in a database table that have a date in the current year?
I am writing a module that displays a count of the number of records depending on the date_time column. I am able to get the result that I am looking for when using a static date as below. However, I ...
3
votes
1
answer
174
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 ...
1
vote
3
answers
328
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,
#...
1
vote
2
answers
249
views
Database query with OR WHERE and AND WHERE not working
I'm creating a custom search form in Joomla! to search articles from certain categories.
Here is my query:
$categories = array('2', '12', '16');
$query
->select(array('id', 'title', 'catid'))
...
1
vote
1
answer
98
views
Query gives a single value when two columns in SELECT clause
I do have a database connection earlier in the script.
$db = JFactory::getDbo();
Here's the query code:
$albumartistidquery = $db->getQuery(true);
$albumartistidquery->select($db->...
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 = '...
0
votes
0
answers
65
views
Joomla 3 Custom PHP Script needs to be updated for Joomla 4
I have a custom php script that was written for a Joomla 3 site.
Of course on Joomla 4 it doesn't work.
I've been working on re writing the query statements to use prepared statements but even with ...
1
vote
1
answer
50
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 ...