missing 'where'

Status
Not open for further replies.

Fred04

Member
in my databasejoin element I filter the data
where company.id IN (SELECT user.idcomp
FROM user WHERE user.idjuser = {$my->id})

it used to work perfect but my databasejoin element no longer returns anything. I have the following warning:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.idjuser = 42) ORDER BY text ASC' at line 3 SQL=SELECT DISTINCT(`company`.`id`) AS value, descr AS text FROM `company` AS `company` WHERE company.id IN (SELECT user.idcomp FROM user user.idjuser = 42) ORDER BY text ASC

the 'WHERE' is missing; why??

based on my analysis:
c9c3d0bb7224bb6aa80c6f1e6b734cf78a96f062 is the first bad commit
 
Can you test this fix for me:

Edit ./plugins/fabrik_element/databasejoin/databasejoin.php, around line 680 is:

PHP:
		else
		{
			$where = JString::str_ireplace('WHERE', '', $where);
			$query->where($where);
			return $query;
		}

Change that str_ireplace line to this:

PHP:
			$where = FabrikString::ltrimword($where, 'WHERE');

-- hugh
 
I'm using the latest Github
The problem of the missing WHERE is fixed... but now I have too many WHERE

Here is the error I have


You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where company.id IN (SELECT user.idcomp FROM user WHERE user.idjuser = 42) ORDE' at line 3 SQL=SELECT DISTINCT(`company`.`id`) AS value, descr AS text FROM `company` AS `company` WHERE where company.id IN (SELECT user.idcomp FROM user WHERE user.idjuser = 42) ORDER BY text ASC

thanks for the support
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top