Loop with wpdb class
-
Hi,
I need a little help, i’m developing my first plugin, and i need to push some data from database using wpdb class and populate a select with this data.
So i start to push it, but i don’t know how to do the loop with the data.
<select name='wcwp_settings[wcwp_select_state]' id="cod_estados"> <option value='0'>Selecione uma Op??o</option> <?php global $wpdb; $states = $wpdb->get_col("SELECT nome FROM estados"); $i = 0; while($i <= '27'){ ?> <option value='0'><?php echo $states[$i]; ?></option> <?php $i++; } ?> </select>
Do you know how to do it?
Thanks ??
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Loop with wpdb class’ is closed to new replies.