I have a single table and i would like to calculate two columns (imp and clicks) while looping through the results.
this is what the table would look like...
campaign | imp | clicks
A | 200000 | 100
B | 100000 | 40
C | 50000 | 10
D | 300000 | 200
and here's what i would like to achieve with a mysql query and php. I would like to create a new column CTR% and calculate the CTR for each row by looping through the table...
campaign | imp | clicks | CTR %
A | 200000 | 100 | 0.05
B | 100000 | 40 | 0.04
C | 50000 | 10 | 0.02
D | 300000 | 200 | 0.06
i've tried a few things that i've read up on by googling but none really worked (based on using a while loop). now i would like to wipe the slate clean and get your suggestions on what to do??
this is what the table would look like...
campaign | imp | clicks
A | 200000 | 100
B | 100000 | 40
C | 50000 | 10
D | 300000 | 200
and here's what i would like to achieve with a mysql query and php. I would like to create a new column CTR% and calculate the CTR for each row by looping through the table...
campaign | imp | clicks | CTR %
A | 200000 | 100 | 0.05
B | 100000 | 40 | 0.04
C | 50000 | 10 | 0.02
D | 300000 | 200 | 0.06
i've tried a few things that i've read up on by googling but none really worked (based on using a while loop). now i would like to wipe the slate clean and get your suggestions on what to do??