Good day.

The wordpress database has a table, called wp-post by default. I chose its value like this:

$sql="SELECT MAX(`id`) FROM wp_posts "; 

This is a function, and not all of it, but most importantly, the bar-dump code produced the value, got the following:

 array(1) { [0]=> array(1) { ["MAX(`id`)"]=> string(5) "11373" } } 

Now the question is: how do I get the key value "MAX( id )" , given that it is stored in a second-level array?

    1 answer 1

     $id = 0; $result = $mysqli->query("SELECT MAX(`id`) AS `max` FROM `wp_posts`"); if($data = $result->fetch_assoc()){ $data = reset($data); $id = $data['max']; } 

    Something like that..