$wpdb foreach code example
Example: $wpdb foreach
$records=$wpdb->query("SELECT * FROM $wpdb->posts WHERE post_type = 'elements' AND post_status = 'publish'");
while($data=$records->fetch_assoc())
{
print_r($data);
}
}
$records=$wpdb->query("SELECT * FROM $wpdb->posts WHERE post_type = 'elements' AND post_status = 'publish'");
while($data=$records->fetch_assoc())
{
print_r($data);
}
}