I have a table in a hosting I want to communicate with it remotely through my localhost, but I can't reference that I want the table from that database how do I do that?
*im using php *
<?php
// Create connection
$conn = mysqli_connect('localhost', 'root', '','contador');
$conn2 = mysqli_connect('hostingIP', 'userIp', 'userPass');
$tableName='contador';
$dbname2='dbHosting';
$result = mysqli_query($conn2,$dbname2);
$sql = "INSERT INTO tab2 (Data,Acessos) VALUES ( now(),(SELECT COUNT(*) FROM $result.$tableName WHERE DATE(Data)= CURRENT_DATE() - INTERVAL 0 DAY))";
?>
Thank me later:)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.