php - Query to retrieve data where a variable is stored in the column name -
i have database looks this.
width | 10 | 20 | 30 | 40 ---------------------------- 10 | $2 | $3 | $4 | $5 20 | $3 | $4 | $5 | $6 30 | $4 | $5 | $6 | $7 40 | $5 | $6 | $7 | $8
the top row column names. how pull money value out if given 2 numerical values?
or easiest way reorganise data new columns?
edit:
the numbers in column name heights , numbers in width column widths.
if plug in numbers 10 height , 20 width, i'd want $3 result.
thank you!
try :
// assert $height column exists before query $sql = "select {$height} table width = :b_width";
Comments
Post a Comment