News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

SubQuerys

Started by DaLoE, July 25, 2020, 10:33:19 AM

Previous topic - Next topic

DaLoE

Im trying to do a sub-query and I'm getting the $txt['database_error'] and $txt['try_again'] message. If I remove the modSettings lines, i get Hacking Attempt. I tried to remove lines 383-385 of my Subs-DB-mysql.php file but I'm still getting the same error.

global $modSettings;
$disableQueryCheckBack = $modSettings['disableQueryCheck'];
$modSettings['disableQueryCheck'] = true;

$queryexp = $smcFunc['db_query']('', "
SELECT *
FROM
    (
        SELECT *
        FROM {db_prefix}exped_seguim
        WHERE id_usuario = 83
    ) AS t
RIGHT JOIN {db_prefix}exped AS expe ON (t.id_exp =
expe.id_exped");


$modSettings['disableQueryCheck'] = $disableQueryCheckBack;


Is something wrong with the query? How can I do it? Maybe not using $smcFunc['db_query']? What should I do?



Thanks.

vbgamer45

You have it right with $modSettings['disableQueryCheck'] = true;
You have a bug with your SQL you are missing a  )
after RIGHT JOIN {db_prefix}exped AS expe ON (t.id_exp =
               expe.id_exped
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

DaLoE

Quote from: vbgamer45 on July 25, 2020, 10:54:36 AM
You have it right with $modSettings['disableQueryCheck'] = true;
You have a bug with your SQL you are missing a  )
after RIGHT JOIN {db_prefix}exped AS expe ON (t.id_exp =
               hxxp:expe.id [nonactive]_exped

Thanks... I can sleep now... Im very dumb

Thanks

Arantor

I don't understand why this even needs a subquery in the first place.

Advertisement: