Hi. PHP newbie getting to grips with things.
I'v got a simple test page to display the fist 4 images from a database... but what I'd really like it to do is display 4 RANDOM images from the database without repeating any. i.e. each one should be unique.
I realise I could do this by having 4 variables and run if or while functions to prevent their from being any duplicates... but that get's messy if I need to have much more than 4, and I would like to have the possibility of changing the amount of 4 to 10, 20 or 100 in the future.
I suppose I would need some sort of array to do this but I'm not getting very far without help.
So, is there any way to use $RANDVAR in such an array?
Thanks,
Dan
----------------------------------------
Knowing is not enough, we must apply. Willing is not enough, we must do.
--So said the ever wise Bruce Lee
Memorize and live by it!
I'v got a simple test page to display the fist 4 images from a database... but what I'd really like it to do is display 4 RANDOM images from the database without repeating any. i.e. each one should be unique.
I realise I could do this by having 4 variables and run if or while functions to prevent their from being any duplicates... but that get's messy if I need to have much more than 4, and I would like to have the possibility of changing the amount of 4 to 10, 20 or 100 in the future.
I suppose I would need some sort of array to do this but I'm not getting very far without help.
So, is there any way to use $RANDVAR in such an array?
Thanks,
Dan
----------------------------------------
Knowing is not enough, we must apply. Willing is not enough, we must do.
--So said the ever wise Bruce Lee
Memorize and live by it!