Cannot add "where" in a query, error Not acceptable

sales2010

Well-Known Member
Hello,

Not very sure if it's related to Fabrik (i searched the forum and found some topics about this error, but there is no final conclusion) but every time i tried to add a conditional statement to a query using a php plugin or a calc element, i see this error:

Not Acceptable

An appropriate representation of the requested resource /administrator/index.php could not be found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

The message appear only if i add the clause "where", otherwise will run fine. For example, i tried to use this query:

Code:
$query->select($db->quoteName('group_id'));
$query->from($db->quoteName'#__user_usergroup_map');
$query->where('user_id = 122');

same problem if the value for user_id is set to be dynamic:

Code:
$query->where($db->quoteName('user_id')." = ".$db->quote($iduser));

I also tried to run this query in a test.php file:

Code:
$result = mysql_query("SELECT group_id FROM jos_users_usergroup_map where id=122");
$row = mysql_fetch_array( $result );
echo "Grup: ".$row['group_id'];

and is running fine, i can add any statements and conditions..

What could be the problem?
 
$query->from($db->quoteName'#__user_usergroup_map');
Is this really your code (or just wrong pasted here)?

$query->from($db->quoteName('#__user_usergroup_map'))
$query->from('#__user_usergroup_map');
 
I tried now using the code provided by Fabrik, same problem:

Code:
$token = JRequest::getVar('token');
$db = JFactory::getDbo();
$query = $db->getQuery(true);
 
$query
    ->select('id')
    ->from('aplicatii_mesaje')
    ->where('token = ' . $db->quote(token);
 
$db->setQuery($query);
$fieldA = $db->loadResult();
return $fieldA;

Work fine if i remove the "where" clause ...
 
i should wear some glasses...

even so, same problem, but... i found that i cannot install any new extension using the regular install option. So i think the problem is because of my webserver instead of Joomla..let me contact the hosting provider and i'll return here after that.
 
ok, i installed again joomla + fabrik; the error about not being able to install new extension is gone now. The only problem now is the fact that i cannot add any conditional query in a php plugin or a calc element. Strange is that i can run any type of query in a test.php file, so "outside" Fabrik everything seems to be ok..

P.S: i activated the logs, debug and everything else, i can't find any error. My hosting provider still investigate this problem..
 
Problem solved..i don't know how because the hosting provider didn't gave me any response, but i just tested it and now i'm able to save queries..
 
Are you saying you were getting this when you tried save after editing the element / form on the backend?

That "appropriate representation" error is almost always a result of something like Apache's modsec (Mod Security) or some similar security filter, which mis-interprets the raw SQL commands being passed in through the settings form as an SQL injection attack, and rejects that request.

I suspect if you reported this to your provider, they either checked the modsec logs and turned off whatever rule was triggering, or turned modsec off entirely.

Do you have a shared host, or a VPS / dedicated? If you have a VPS / dedicated (so you have full root access) you can check and tweak modsec yourself, and I'd be happy to show you how if you run in to these issues again. if you run on a shared host, you are SOL and at the mercy of your host support. :)

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top