SQL doesn’t return values
-
I have this below SQL which looks at NextGen Gallery’s wp_ngg_tags table, and do a count. Then it loops through all the rows to bring back the name value.
I couldn’t get it to do what I wanted, but it does the “count” alright.
<?php global $wpdb; $sql = 'SELECT COUNT(*) FROM wp_ngg_tags '; $count= $wpdb->get_var($sql); echo $count; echo "<hr>"; for ( $counter = 1; $counter <= $count; ) { $row = 'SELECT name FROM wp_ngg_tags where id='.$counter; $name= $wpdb->get_var($row); echo $name; $counter=$counter+1; } ?>
Any help would be appreciated.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘SQL doesn’t return values’ is closed to new replies.