Page 1 of 1

Searching a database column (mySQL)

Posted: Thu Mar 20, 2008 12:08 am
by jc_ply
Hey I'm new to the forums and have just begun getting to grips with PHP to enhance my flash work. Anyway spent the last 2 weeks tackling it and im to the point where I'm a little confused on which way to go.

Basically i have a table which looks like this

id | name | img1 | img2 | img3 |

1 dave 3 5 3


the 3 5 3 are integers which will stand for image ids selected by the user and i need to find the most popular id and return the value via an integer to be picked up by flash (loadVars). So I need to search a column e.g "num1" find the most popular id and add up how many instances there are of it. My initial thoughts were towards arrays and loops but not too sure if im missing something being new to server side scripts.

I know I should probably separate the images and use a relational database but time is short, and my coding abilities are not too hot at the moment. I'd appreciate any help and hope to become more involved on the forum in the future.

Thanks,

Jason

Re: Searching a database column (mySQL)

Posted: Thu Mar 20, 2008 12:31 am
by Christopher
MySQL has some statistical functions:

http://dev.mysql.com/doc/refman/5.1/en/ ... tions.html

Re: Searching a database column (mySQL)

Posted: Sat Mar 22, 2008 3:05 pm
by jc_ply
thanks that literature pointed me in the right direction