24wpdb foreach

Solutions on MaxInterview for 24wpdb foreach by the best coders in the world

showing results for - " 24wpdb foreach"
Luigi
20 Jul 2017
1get_header();
2function get_records()
3{
4	//$con=connectsql();
5	$records=$wpdb->query("SELECT * FROM $wpdb->posts WHERE post_type = 'elements' AND post_status = 'publish'");
6	$all=array();
7	while($data=$records->fetch_assoc())
8	{
9		$all[]=$data;
10	}
11	return $all;
12}
Neyla
18 Feb 2016
1
2	$records=$wpdb->query("SELECT * FROM $wpdb->posts WHERE post_type = 'elements' AND post_status = 'publish'");
3
4	while($data=$records->fetch_assoc())
5	{
6		print_r($data);
7	}
8	
9}