How to query a particular part of an array in a db column? - Joomla! Forum - community, help and support
i'm trying create form have ability set multiple parameters/filters searching particular database table, i'm getting little stuck because way designed table such figuring out how search parts of beyond skill
(a little knowledge can dangerous thing!)
so, 1 of columns in table 'demographics' , in column i'm storying array of data, e.g.,
so, i'm trying create query necessary allow 1 filter data in table, including criteria based on demographics contained in 1 field... e.g., user may choose # of days dates (different field), want hard-code in 'eligibility' '1', , choose 'intention' and/or 'party'...
the query i've got right is:
this works when chooses options in form... 'default' value $votingintention needs cover possibilities -- how that? i've got if $_post['votingintention'] == null $votingintention = "", no results.
thanks,
scott
so, 1 of columns in table 'demographics' , in column i'm storying array of data, e.g.,
code: select all
{"intention":"barack obama","party":"registered democrat","age":"50-65","eligibility":"1","ipaddress":"75.130.176.70","city":"hoffman forest","region":"nc","country":"us"}so, i'm trying create query necessary allow 1 filter data in table, including criteria based on demographics contained in 1 field... e.g., user may choose # of days dates (different field), want hard-code in 'eligibility' '1', , choose 'intention' and/or 'party'...
the query i've got right is:
code: select all
$queryall = "select * ".$db->namequote('#__poll_responses')." date(".$db->namequote('date').") between '$rollingstartdate' , '$rollingenddate' , ".$db->namequote('demographics')." '%\"intention\":\"".$votingintention."\"%' , ".$db->namequote('qid')." = '$qid' , ".$db->namequote('demographics')." '%\"eligibility\":\"1\"%';";this works when chooses options in form... 'default' value $votingintention needs cover possibilities -- how that? i've got if $_post['votingintention'] == null $votingintention = "", no results.
thanks,
scott
i think figured out... looks can make $votingintention = "%" default, query works little change. 
Comments
Post a Comment