php - Parse multiple $variable values from single query? -


i'm trying learn more economical way of parsing out multiple variable values single mysql_fetch_array query. know write whole series of individual queries resolve this, that's lot of coding , queries hit server , seems grossly inefficient.

the base query i'd work is:

select vehicletype, vehiclelength my_dbase.my_table arriveday = '08/07/2013' , process_status = 'completed' 

vehicletype has 1 of 4 fixed values assigned, , vehiclelength has 1 of 5 fixed values assigned option_value fields on form page.

what need parse result of query count number of records found each pair-combination , assign $variable value each pair-combination display in php-generated table. have 4 different dates need run operation for.

i've tried iterations of creating array() or using array_count_values() output of mysql_fetch_array result no success.

perhaps can try,

select count(*), vehicletype, vehiclelength  my_dbase.my_table arriveday = '08/07/2013'  , process_status = 'completed' , vehicletype  in ('t1','t2','t3','t4') , vehiclelength  in('1','2','3','3') group vehicletype, vehiclelength  order vechicletype 

i let mysql work.


Comments