php - Use value from checkbox in query -


i have checkbox input value set 0.

<form id="formfilter2" name="formfilter2" method="post" action="">     <input name="selview" type="checkbox" id="selview" onchange="formfilter2.submit()"       value="0" <?php echo (isset($_post['selview'])?'checked':'');?> />      view accounts no fees assigned </form> 

i set query left join table (fees) counts how many fees account has. when view data can see count after every corresponding members.name. 0 shows if there no record in fees table members.id. members have not been assigned fee. trying use checkbox filter names , show me have 0 assigned.

$varview_recordsetmembers = "%"; if (isset($_post['selview'])) {   $varview_recordsetmembers = $_post['selview']; }  $varfilter_recordsetmembers = "%"; if (isset($_post['selfilter'])) { $varfilter_recordsetmembers = $_post['selfilter']; }  $colname_recordsetmembers = "%"; if (isset($_get['search'])) { $colname_recordsetmembers = $_get['search']; }  $query_recordsetmembers = sprintf("select distinct members.tag, members.id, members.name,  coalesce((count(case when fees.type='fee' fees.id end)) ,0) 'feez' members  left join fees on members.id=fees.id (members.dept %s , (members.name %s  or members.id %s)) group members.id having 'feez' %s order members.name,  members.dept", getsqlvaluestring($varfilter_recordsetmembers, "text"), getsqlvaluestring("%" . $colname_recordsetmembers . "%", "text"), getsqlvaluestring("%" . $colname_recordsetmembers . "%", "text"),  getsqlvaluestring($varview_recordsetmembers, "text")); 

by default records show members , use checkbox toggle between members , filter no fees. when view data can see count after every corresponding members.name. 0 shows if there no record in fees table members.id. members have not been assigned fee. trying use checkbox filter names , show me have 0 assigned. using having 'feez' %s (or count) query data show on ly members no records or fees. tried use coalesce no success. appreciated.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -