How can an existing query be stored in a variable in PHP?

To store an existing query in a variable in PHP, you can simply assign the query string to a variable. This can be useful for reusing the same query multiple times in your code without having to rewrite it each time.

// Existing query
$query = "SELECT * FROM users WHERE age > 18";

// Store the query in a variable
$myQuery = $query;

// Now you can use $myQuery in your code to execute the query