Answer the question
In order to leave comments, you need to log in
How to import via php record from one database to another?
Hello, tell me please, I want to call a function by pressing a button that would take a record of a certain table from the database and write this record to another database unchanged, how to implement this?
function call i will use like this
if(isset($_GET['add_new_post'])) {
$usr->addNewPost($crt_usr);
header("Location: post.php");
exit(0);
}
function add_new_post($id) {
global $db;
//какой-то запрос в первую базу
$sql=$db-> ....
//подключение ко второй базе
$link = mysqli_connect('localhost', 'baza', 'password', 'table');
$sql_x=$db-> ....
mysqli_close($link);
}
Answer the question
In order to leave comments, you need to log in
See in any tutorial how to make INSERT queries in PHP.
And do as it says.
try to file all this with an ORM library, for example, from https://redbeanphp.com/index.php
ORM itself will parse what fields are in the source table and create or add them to the final table.
Your question is certainly not an easy one, so it is unlikely that anyone here will write a whole application for you.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question