Begin to see the code below, you will find two databases connections.

First it obtain the data from first connection after which place into second database connection but it won't place - I'm able to a mistake saying Unknown column 'fullname' in 'field list'

After I attempted SQL query by hand in phpMyAdmin also it work fine...

$db_new = mysql_connect('localhost', 'root', 'password');
if (!mysql_select_db("menu_new", $db_new)) {
    die("Cant connect menu_new DATABASE");

$db_old = mysql_connect('localhost', 'root', 'password');
if (!mysql_select_db("old_menu", $db_old)) {
    die("Cant connect old_menu DATABASE");

$SQL_old = "SELECT * FROM old_table";
$q = mysql_query($SQL_old, $db_old);

while ($row = mysql_fetch_assoc($q)) {
    $name = $row['name']; 

    $SQL = "INSERT INTO tbl_name (fullname) values ('$name')";

     //Problem Here - It wont insert into second database
     mysql_query($SQL, $db_new) or die(mysql_error($db_new));

There is nothing strange within this behavior. Just add the $link parameter in your mysql_connect calls, and hang it to true. Automatically it's False also it implies that re-using this function with similar parameters, that is what you are doing because the db title is this is not on your mysql-connect, will reuse existing connexion with same parameters. So you've two variables only one connexion.

This means you are simply moving the db utilized in this connexion. Prefixing using the db title fixed the issue as MySQL allow inter-base manipulations in the same connexion whether it's on a single db server.

Thanks @Konerak for suggestion which works!

To Place/Choose data from Database connection, you'll have to include database title prior to the table title.

For Instance


mysql_query("INSERT into tbl_name (fullname) values ('1')", $db_new) or die(mysql_error($db_new));


mysql_query("INSERT into menu_new.tbl_name (fullname) values ('1')", $db_new) or die(mysql_error($db_new));

That's really odd though.