// used to call the function below function wp_quotes_random() { global $wpdb; $sql = "SELECT * FROM " . WP_QUOTES_TABLE . " WHERE visible='yes' ORDER BY rand() LIMIT 1"; $result = $wpdb->get_results($sql); if ( !empty($result) ) wp_quotes_spew($result[0]); }