Is there a more efficient way to handle multiple MySQL queries in PHP, similar to how phpMyAdmin handles them?

When handling multiple MySQL queries in PHP, it is more efficient to use prepared statements with parameter binding to prevent SQL injection and improve performance. This approach allows for the execution of multiple queries in a single database connection, similar to how phpMyAdmin handles them.

// Create a new PDO connection
$pdo = new PDO('mysql:host=localhost;dbname=mydatabase', 'username', 'password');

// Prepare the first query
$stmt1 = $pdo->prepare("SELECT * FROM table1 WHERE column1 = :value");
$stmt1->bindParam(':value', $value);
$stmt1->execute();

// Prepare the second query
$stmt2 = $pdo->prepare("SELECT * FROM table2 WHERE column2 = :value");
$stmt2->bindParam(':value', $value);
$stmt2->execute();

// Fetch results from the first query
$results1 = $stmt1->fetchAll();

// Fetch results from the second query
$results2 = $stmt2->fetchAll();

// Close the connection
$pdo = null;