I have a query below that gives a simple list of plants (a field called "thriller")
Problem:
In the query below, only the first consecutive set of matching elements from the table is considered, and then displayed in random order. The request does not consider other relevant elements that will be found later in the table.
Solution Required:
I want the query to select random results from ALL elements in the table, and not just the first set of matching results.
$row_object = $wpdb->get_results( $wpdb->prepare(
"SELECT * FROM {$wpdb->prefix}personal_creations_assistant
WHERE pot_sun_exposure = %s
AND pot_height = %s
AND pot_size = %s
AND pot_shape = %s
AND pot_placement = %s
GROUP BY thriller
ORDER BY RAND() LIMIT 0,3
",
$sun_exposure,
$height,
$size,
$shape,
$placement
)
);
source
share