me podrian ayudar a resolver esto:
Tengo un problema en traerme el ultimo ID de una tabla en la base de datos.
<?php
// 1. Basic connection opening (for MySQL)
$host = 'localhost';
$database = 'sc';
$user = 'root';
$password = '';
$dsn = "mysql:host=$host;dbname=$database;charset=utf8";
$pdo = new PDO($dsn, $user, $password);
// 2. Selected last id field of table customers
$query = "SELECT MAX(id) FROM customers";
$query_success = $pdo->query($query);
echo $query_success;
?>
ERROR
Fatal error: Uncaught Error: Object of class PDOStatement could not be converted to string in C:\laragon\www\sc\test.php:15 Stack trace: #0 {main} thrown in C:\laragon\www\sc\test.php on line 15