0

I am getting an array of 25 items from a database using SQL. I want to take 16 of the items and random to use. I thought if I could randomly sort the array I could then take the first 16 items.

Is there a way to randomly sort an array in php, or perform an SQL SELECT that returns to results in a random order?

0

1 Answer 1

5

You can do this in SQL:

<your select here>
order by rand()
limit 16;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.