Attempting to copy a database right into a new database, utilizing a PHP script that runs SQL queries on the MySQL server. The code I've sofar is:

$dbh->exec("CREATE DATABASE IF NOT EXISTS $new_news CHARACTER SET UTF8;");
$results = $dbh->query("SHOW TABLES FROM $old_news");
$table_list = $results->fetchAll(PDO::FETCH_NUM);

foreach($table_list as $table_row){
    foreach($table_row as $table){
        $results = $dbh->query("SELECT table_type FROM information_schema.tables where table_schema = '$old_news' and table_name = '$table'");
        $table_type = $results->fetch(PDO::FETCH_ASSOC);
        $table_type = $table_type['table_type'];
        if($table_type == 'BASE TABLE'){
            echo "Creating table $table and populating...\n";
            $dbh->exec("CREATE TABLE $new_news.$table LIKE $old_news.$table");
            $dbh->exec("INSERT INTO $new_news.$table SELECT * FROM $old_news.$table");
        }else if($table_type == 'VIEW'){
            //echo "Creating view $table...\n";
            //$dbh->exec("CREATE VIEW $new_news.$table LIKE $old_news.$table");
            echo "$table is a view, which cannot be copied atm\n";  
        }else{
            echo "Skipping $table_type $table, unsupported type\n"; 
        }
    }
}

This presently looks whatsoever tables in $old_news, finds the table enter in the information_schema, and produces the same table in $new_news with respect to the type. For tables, it produces the table structure exactly the same, then 'INSERT INTO SELECT' to fill them.

How can you copy a view without mysqldump the whole database?

You should use INFORMATION_SCHEMA.VIEWS to determine the vista definition, or SHOW CREATE VIEW for the entire statement.

One option is to choose SHOW CREATE VIEW for each view which returns the vista creation syntax.

See 12.4.5.10. SHOW CREATE VIEW Syntax for particulars.