11
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 wish it turns out to be on 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 ());
?>
What mistake happened?
– rray
Put the
i
in front of allmysql
... plain as that.– gmsantos
@lost no error happened just wish I could have the files connected via mysqli
– Ricardo Jorge Pardal
https://php.net/manual/en/book.mysqli.php in 10 minutes you resolve
– Manuel Gerardo Pereira
@gmsantos already tried it and it didn’t work was the first thing I tried even before I started researching.
– Ricardo Jorge Pardal
Changed them all? Sure? How did you change it? It replaced all all the files of your project?
– gmsantos
Thanks @Manuel Gerardo Pereira but I’ve been mainly on this page for 3 weeks and I can’t.
– Ricardo Jorge Pardal
@gmsantos Yes after I got the link with the variables I went from 110 files and (I had said that there were 80 but 110) to only 40 and now I just can’t convert these two files.
– Ricardo Jorge Pardal
You will have a lot of work to do this change. Recommend that you use PDO instead of Mysqli. PDO or Mysqli: Which one you should use? Tutorial of building a more complete class. PDO supports multiple databases and actually has named parameters. I hope I helped.
– user15299