I decided to listen to some users to make the conversion but I need your help because I have done a lot of research and nothing works.
The first file is:
<?php
include_once("/pasta/connectserver.php");
$table = "rjpsync_tag, rjpsync_ipserver";
function assoc_query_2D($sql, $id_name = false){
$result = mysql_query($sql);
$arr = array();
$row = array();
if($result){
if($id_name == false){
while($row = mysql_fetch_assoc($result))
$arr[] = $row;
}else{
while($row = mysql_fetch_assoc($result)){
$id = $row['id'];
$arr[$id] = $row;
}
}
}else
return 0;
return $arr;
}
function query_whole_table($table, $value = 'ipserver1, ipsserver, ipserverfim'){
$sql = "SELECT $value FROM $table WHERE idserver = 1";
return assoc_query_2D($sql);
}
$export_str = "";
$result = query_whole_table($table);
foreach($result as $record){
$export_str .= implode("",$record);
}
file_put_contents("/pasta/ipserver1.php", $export_str);
?>
And the second file is:
<?php
include_once("/pasta/connectserver.php");
function salvaip() {
$ip = file_get_contents('/pasta/myip.txt','r');
$ip = mysql_escape_string($ip);
$sql = "UPDATE rjpsync_ipserver SET ipsserver='".$ip."' WHERE idserver=1";
if (mysql_query($sql)) {
return true;
}
fclose($ip);
}
salvaip();
?>
These two files are linked to:
# /pasta/connectserver.php
<?PHP
include_once("/pasta/config.php");
$db_host1 = "$s_ipserver1:$db_porta1";
$db_link1 = mysql_connect($db_host1, $db_user1, $db_password1) or die (mysql_error ());
$db_connect1 = mysql_select_db($db_name1, $db_link1);
?>
And I would like to be connected to the following:
# /pasta/connectserveri.php
<?PHP
include_once("/pasta/config.php");
$db_host1 = "$s_ipserver1";
$db_connect1 = mysqli_connect($db_host1, $db_user1, $db_password1, $db_name1, $db_porta1) or die (mysqli_error ());
?>