两个mySQL数据库到一个PHP表单

I am looking for a way to submit data to two mySQL databases from one PHP form.

I want all the text information to go to one database and all the images to go to another.

How would I go about doing this? (See the attached code below, which is still far from where I would like it to be):

<?php
/*
Attempt MySQL server connection. Assuming you are running MySQL
server with default setting (user 'root' with no password)
*/
$link = mysqli_connect("****", "****", "****", "****");

// Check connection
if($link === false){
    die("ERROR: Could not connect. " . mysqli_connect_error());
}

// Escape user inputs for security
$title = mysqli_real_escape_string($link, $_POST['title']);
$price = mysqli_real_escape_string($link, $_POST['price']);
$sqm = mysqli_real_escape_string($link, $_POST['sqm']);
$sqm_land = mysqli_real_escape_string($link, $_POST['sqm_land']);
$type = mysqli_real_escape_string($link, $_POST['type']);
$area = mysqli_real_escape_string($link, $_POST['area']);
$location = mysqli_real_escape_string($link, $_POST['location']);
$bedroom = mysqli_real_escape_string($link, $_POST['bedroom']);
$terrace = mysqli_real_escape_string($link, $_POST['terrace']);
$orientation = mysqli_real_escape_string($link, $_POST['orientation']);
$water = mysqli_real_escape_string($link, $_POST['water']);
$seaview = mysqli_real_escape_string($link, $_POST['seaview']);
$pool = mysqli_real_escape_string($link, $_POST['pool']);
$ownerinfo = mysqli_real_escape_string($link, $_POST['ownerinfo']);
$gaddress = mysqli_real_escape_string($link, $_POST['gaddress']);
$description = mysqli_real_escape_string($link, $_POST['description']);




// attempt insert query execution
$sql = "INSERT INTO property (title, price, sqm, sqm_land, type, area, location, bedroom, terrace, orientation, water, seaview, pool, ownerinfo, gaddress, description) VALUES 
('$title', '$price', '$sqm', '$sqm_land', '$type', '$area', '$location', '$bedroom', '$terrace', '$orientation', '$water', '$seaview', '$pool', '$ownerinfo', '$gaddress', '$description' )";
if(mysqli_query($link, $sql)){
    echo "Records added successfully.";
} else{
    echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}




// close connection
mysqli_close($link);
?>

Any help would be greatly appreciated on this.

You can make more than one database connection like this

$text_db = mysqli_connect("****", "****", "****", "****");

$img_db = mysqli_connect("****", "****", "****", "****");

You then just have to use the correct handle in any subsequent queries you run.

mysqli_query($text_db, 'the query for the test parts')

mysqli_query($img_db, 'the query for the images')

You can change the database when you are done with the other:

mysqli_select_db($link,"new_db_to_choose");

just create two mysql connections:

$link1 and $link2

And then call mysqli_query function with both connections:

mysqli_query($link1, $sql);
mysqli_query($link2, $sql);