Answer the question
In order to leave comments, you need to log in
How to display data from two different databases in 1 cycle?
Hello, tell me how you can display information from two different databases in 1 cycle. So far I have only been able to do this with two cycles, is it possible somehow with one?
$sql_table1 = $link_s1->prepare("SELECT * FROM `bans` ORDER BY `time` DESC");
$sql_table1->execute();
if($sql_table1->rowCount() > 0) {
while($table = $sql_table1->fetch(PDO::FETCH_BOTH)) {
$tmpban = $table['expires'];
$timeConvert_end = $tmpban / 1000;
$bantime = $table['time'];
$timeConvert_start = $bantime / 1000;
echo '<tr class="find"><td>'.$table['name'].'</td>';
echo '<td>'.$table['banner'].'</td>';
echo '<td>'.$table['reason'].'</td>';
echo '<td>'.Date("H:i d.m.Y", $timeConvert_start).'</td>';
if ($tmpban == '0') {
print '<td class="perm">Перманент</td>';
} else {
print '<td>'.Date("H:i d.m.Y", $timeConvert_end).'</td>';
}
}
}
$sql_table2 = $link_s2->prepare("SELECT * FROM `bans` ORDER BY `time` DESC");
$sql_table2->execute();
if($sql_table2->rowCount() > 0) {
while($table = $sql_table2->fetch(PDO::FETCH_BOTH)) {
$tmpban = $table['expires'];
$timeConvert_end = $tmpban / 1000;
$bantime = $table['time'];
$timeConvert_start = $bantime / 1000;
echo '<tr class="find"><td>'.$table['name'].'</td>';
echo '<td>'.$table['banner'].'</td>';
echo '<td>'.$table['reason'].'</td>';
echo '<td>'.Date("H:i d.m.Y", $timeConvert_start).'</td>';
if ($tmpban == '0') {
print '<td class="perm">Перманент</td>';
} else {
print '<td>'.Date("H:i d.m.Y", $timeConvert_end).'</td>';
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question