link forms by province

Code:
$company='{$my->id}';
$db = \Joomla\CMS\Factory::getContainer()->get('DatabaseDriver');
$query = $db->getQuery(true);
$query->select('province');
$query ->from('company');
$query -> where('companyid =' . $company)  ;
$db->setQuery($query);
$result = $db->loadResult();
return $result;
 
Gracias por la ayuda pero sigue pasando lo mismo, no filtra provincias ni profesiones. Todo está en la misma lista que la imagen anterior. También recibo este error al seleccionar "Registrador o Público", al aplicar en el prefiltro
error in public and registred.png
 
{$my->id} will only be replaced it there's a "my", i.e. if you are logged in.
If you calling the list as guest it will keep the unreplaced string and this will create a SQL error because it's not quoted in the query.

So to fix the SQL error do
$query -> where('companyid =' . $db->quote($company) ) ;

This will give you the syntactically correct query ...WHERE companyid ='{$my->id}' ...
but I assume this is not what you want in case of a guest.

So if company should be 0 in this case you can do
$company='{$my->id}';
$company=!is_int($company) ? 0 : $company;
...
 
My base assumption for the code was, that anybody can create a request, but the (filtered) request list is only visible for registered / logged in companies and therefore there is always a valid ID available.

Else probably private contact information of the requestors would be visible to the world (except those would be handled with element access levels). But the question would be: what is the sense for showing guests a list of anonymous requests?
 
{$my->id} will only be replaced it there's a "my", i.e. if you are logged in.
If you calling the list as guest it will keep the unreplaced string and this will create a SQL error because it's not quoted in the query.

So to fix the SQL error do
$query -> where('companyid =' . $db->quote($company) ) ;

This will give you the syntactically correct query ...WHERE companyid ='{$my->id}' ...
but I assume this is not what you want in case of a guest.

So if company should be 0 in this case you can do
$company='{$my->id}';
$company=!is_int($company) ? 0 : $company;
...
Thank you very much for your interest in helping me. Now I understand a little better how it works, although the error is not identified from what it tells me, what is not clear to me is:"So if company should be 0 in this case you can do$company='{$my->id}';$company=!is_int($company) ? 0 : $company;"Furthermore, the form does not reach the company that has registered with the same province and profession. Thank you
 
My base assumption for the code was, that anybody can create a request, but the (filtered) request list is only visible for registered / logged in companies and therefore there is always a valid ID available.

Else probably private contact information of the requestors would be visible to the world (except those would be handled with element access levels). But the question would be: what is the sense for showing guests a list of anonymous requests?
Sorry for the language mix. It is not an automatic translator.What you indicate is precisely what I want, but the filtering does not work for me. When creating a new user with the same province and profession, that request does not appear in the list. What I need is for the user to register in their private panel to have the requests that match their province and profession.
 
Are you developing on a local server or is there the possibilty to check online. Maybe you can send me access details via PM
 
If you click on my picture a small popup appears, where at the bottom a button 'start conversation' appears
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top