mysql - Echo array from sql in php program -


i post ids yesterday on wordpress, sql query works when tried on phpmyadmin, returns ids yesterday. when tried echo ids out of array, values in array 'array' instead of id, should numbers. wonder why did ids in array turned word 'array'. code wrote:

$yesterday = strtotime("-1 days"); $day = (int)date("d", $yesterday); $month = (int)date("n", $yesterday); $year = (int)date("y", $yesterday);  $sql = "     select id     wp_posts     1 = 1     , day(post_date) = $day     , month(post_date) = $month     , year(post_date) = $year ";  global $wpdb; $results = $wpdb->get_results($sql, 'array_n');  foreach ($results $id) {     echo '<br>' . $id; } 

update: changed type of output array_a , added var_dump() before foreach loop see what's inside array, , got:

output

use array_a associative array instead of array_n returns numerically indexed multidimensional array .. $results in code multidimensional array .. use var_dump() instead on echo view variable contents ( testing )


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -