multiple arrays within a loop in PHP

Hello this code works but currently it is very repetitive.

I have been trying for a few days now and I just cannot work out how to rewrite these separate selects into one loop using arrays.

I would like to push is to about 20 entries so if I cannot work out how to do the loop then its going to messy! 🙁

I would be grateful for any help, Thanks..

                // Create 6 random numbers from table
                $ran_num = (RandomInRange(1,$total,6));

                // Select(grab) data from table from a random row
                $grab1 = "select * from stock_tbl where stock_id='$ran_num[0]'";
                $grab2 = "select * from stock_tbl where stock_id='$ran_num[1]'";
                $grab3 = "select * from stock_tbl where stock_id='$ran_num[2]'";
                $grab4 = "select * from stock_tbl where stock_id='$ran_num[3]'";
                $grab5 = "select * from stock_tbl where stock_id='$ran_num[4]'";
                $grab6 = "select * from stock_tbl where stock_id='$ran_num[5]'";

لینک منبع

دانلود سورس کد Mobile Native Bundle Timeline Applications WoWonder Social PHP Script