I’m not sure what are you trying to do, but you don’t want to use the GROUP BY
clause.
-
If you want to select all entries, use:
mysql_query("SELECT * FROM `testimonials`");
-
If you want to select one random entry, use:
mysql_query("SELECT * FROM `testimonials` ORDER BY RAND() LIMIT 1");
and get rid of the
while
loop:$info = mysql_fetch_array($data);
-
If you want to select a certain number of random entries, use:
mysql_query("SELECT * FROM `testimonials` ORDER BY RAND() LIMIT 2");
Where
2
is number of results you want to recive. This will never return one row twice unless you have the exact same row stored twice in the database. -
If you want to select all entries in random order, use:
mysql_query("SELECT * FROM `testimonials` ORDER BY RAND()");
But please, if you’re starting to learn PHP, don’t use the mysql_*
functions. Use mysqli
or PDO
instead.
2
solved Trying to not have repeating data (MySQL, php) [closed]