Форум: Форум PHPФорум ApacheФорум Регулярные ВыраженияФорум MySQLHTML+CSS+JavaScriptФорум FlashРазное
Новые темы: 0000000
Объектно-ориентированное программирование на PHP. Авторы: Кузнецов М.В., Симдянов И.В. PHP 5. На примерах. Авторы: Кузнецов М.В., Симдянов И.В., Голышев С.В. MySQL на примерах. Авторы: Кузнецов М.В., Симдянов И.В. PHP на примерах (2 издание). Авторы: Кузнецов М.В., Симдянов И.В. Социальная инженерия и социальные хакеры. Авторы: Кузнецов М.В., Симдянов И.В.
ВСЕ НАШИ КНИГИ
Консультационный центр SoftTime

Форум MySQL

Выбрать другой форум

 

Здравствуйте, Посетитель!

вид форума:
Линейный форум Структурный форум

тема: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in
 
 автор: SOul   (08.09.2009 в 15:20)   письмо автору
 
 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Program Files\VertrigoServ\www\module\RT\toppvp.php on line 124
ВОТ код:


<?php
ob_start();
$page_h1 = $lang_069;
$page_title = $lang_070;
$page_descr = $lang_070;
$page_keyws = $lang_070;
include("module/stat-menu.php");
if ($Server = @mysql_connect("$host:$port", "$user", "$pass", True)){
@mysql_query("set names cp1251");
if (@mysql_selectdb("$db1", $Server)){
?>

<SCRIPT language=JavaScript src="engine/overlib_wm.js"></SCRIPT>
<DIV id=overDiv style="Z-INDEX: 1000; VISIBILITY: hidden; POSITION: absolute"></DIV>


<?
$result = mysql_query("SELECT characters.*,classname FROM characters,char_templates WHERE !accesslevel AND char_templates.ClassId=characters.classid ORDER BY pvpkills DESC LIMIT 50", $Server);
$result2 = mysql_query("SELECT clan_id,clan_name FROM clan_data", $Server);
while ($row2 = mysql_fetch_row($result2)) {$clans_array[$row2[0]]=$row2[1];}
$clans_array[0]="";
echo "
<table width=100% border='0' cellpadding='0' cellspacing='0'>
<tr bgcolor=#FFFFFF>
<td><font color=#000><br><b>№</b><br><br></font></td>
<td>&nbsp&nbsp&nbsp&nbsp</td>
<td><font color=#000><b>$lang_019</b></font></td>
<td><font color=#000><b>$lang_063</b></font></td>
<td><font color=#000><b>$lang_064</b></font></td>
<td>&nbsp&nbsp&nbsp&nbsp</td>
<td><font color=#000><b>$lang_065</b></font></td>
<td><font color=#000><b>$lang_066</b></font></td>
</tr>";

$i = 1;
while ($row = mysql_fetch_array($result))
{
//if ($row["sex"] == '0') {$Sex = "<font color=#8080FF>Мж.</font>";} else {$Sex = "<font color=#FF8080>Жен.</font>";}

if (($row['sex']==0) && ($row['race']==4)) { $img='./engine/img/face/dwarf_male.gif'; }
if (($row['sex']==1) && ($row['race']==4)) { $img='./engine/img/face/dwarf_female.gif'; }
if (($row['sex']==0) && ($row['race']==2)) { $img='./engine/img/face/darkelf_male.gif'; }
if (($row['sex']==1) && ($row['race']==2)) { $img='./engine/img/face/darkelf_female.gif'; }
if (($row['sex']==0) && ($row['race']==0)) { $img='./engine/img/face/human_male.gif'; }
if (($row['sex']==1) && ($row['race']==0)) { $img='./engine/img/face/human_female.gif'; }
if (($row['sex']==0) && ($row['race']==1)) { $img='./engine/img/face/elf_male.gif'; }
if (($row['sex']==1) && ($row['race']==1)) { $img='./engine/img/face/elf_female.gif'; }
if (($row['sex']==0) && ($row['race']==3)) { $img='./engine/img/face/orc_male.gif'; }
if (($row['sex']==1) && ($row['race']==3)) { $img='./engine/img/face/orc_female.gif'; }


if ($row["race"] == '1') {$Race = "Elf";}
elseif ($row["race"] == '2') {$Race = "Dark&nbsp;Elf";}
elseif ($row["race"] == '3') {$Race = "Orc";}
elseif ($row["race"] == '4') {$Race = "Dwarf";}
elseif ($row["race"] == '5') {$Race = "Kamael";}
else {$Race = "Human";}

if ($online = $row["online"]==1) {$online='<a href="online.html"><font color=green>Online</font></a>'; }
else {$online='<font color=red>Offline</font>'; }
$Lvl = $row["level"];
$name = $row["char_name"];
$Class = $row["classname"];
$PVP = $row["pvpkills"];
$PK = $row["pkkills"];
$obj_Id = $row['obj_Id'];
if ($clan = $clans_array[$row["clanid"]]) {
$ClanName = "<a href=clan.html><font color=#0000CD>$clan</font></a>";
} else {
$ClanName = $lang_067;
}
$onlinetimeH = 0;
$onlinetimeM = 0;
if ($row['onlinetime'] != '0') {
$onlinetimeH = round(($row['onlinetime']/60/60)-0.5);
$onlinetimeM = round(((($row['onlinetime']/60/60)-$onlinetimeH)*60)-0.5);
}
if ($onlinetimeH <= 0) {$onlinetimeH = '??';}
$timeonline = $onlinetimeH."&nbsp;ч.&nbsp;".$onlinetimeM."&nbsp;м.";
$infos = InfosUser($obj_Id, $Server);
if ($i/2 == (int) ($i/2)) {
echo "<tr bgcolor=#FFFFFF>
<td><font color=#000><br>&nbsp&nbsp;$i<br><br></font></td>
<td> </td>
<td onmouseover=\"return overlib('".$infos."');\" onmouseout=\"return nd();\"><b><font color=#000>$name</font><b><br><font color=#0000CD size=1 face=verdana>$Class, $Lvl+</font></td>
<td onmouseover=\"return overlib('".$infos."');\" onmouseout=\"return nd();\">&nbsp&nbsp<img src='$img'></td>
<td><font color=#0000CD>$ClanName</font></td>
<td></td>
<td>&nbsp&nbsp&nbsp&nbsp<font color=#0000CD><b>$PVP</b></font><font color=#000>/</font><font color=red><b>$PK</b></font></td>
<td><font color=#000>$online</font></td>
</tr>";
} else {
echo "<tr bgcolor=#DFDFDF >
<td ><font color=#000><br>&nbsp&nbsp;$i<br><br></font></td>
<td> </td>
<td width=40% onmouseover=\"return overlib('".$infos."');\" onmouseout=\"return nd();\"><b><font color=#000>$name</font><b><br><font color=red size=1 face=verdana>$Class, $Lvl+</font></td>
<td width=20% onmouseover=\"return overlib('".$infos."');\" onmouseout=\"return nd();\">&nbsp&nbsp<img src='$img'></td>
<td><font color=#0000CD>$ClanName</font></td>
<td></td>
<td width=20% >&nbsp&nbsp&nbsp&nbsp<font color=#0000CD><b>$PVP</b></font><font color=#000>/</font><font color=red><b>$PK</b></font></td>
<td width=20%><font color=#000>$online</font></td>
</tr>";
}
$i++;
}
echo '<tr><td class=TCaption colspan=8 align=right><b>'.$lang_068.' '.mysql_num_rows($result).'</b></td></tr></table></center>';
}else {echo $no_connect;}
}else {echo $no_connect;}
Function InfosUser($obj_Id, $Server) {
$result = mysql_query("SELECT clan_id,clan_name FROM clan_data", $Server);
while ($row = mysql_fetch_row($result)) {$clans_arr[$row[0]] = $row[1];}
$clans_arr[0] = '';
$sql = "SELECT characters.*,classname FROM characters,char_templates WHERE !accesslevel AND char_templates.ClassId=characters.classid AND characters.obj_Id='".$obj_Id."' ORDER BY exp DESC LIMIT 50";
$result = mysql_query($sql, $Server);
while ($row = mysql_fetch_array($result)) { if ($row['race'] == '1') { =>>> 124 строчка
$Race = 'Elf';
} elseif ($row['race'] == '2') {
$Race = 'Dark Elf';
} elseif ($row['race'] == '3') {
$Race = 'Orc';
} elseif ($row['race'] == '4') {
$Race = 'Dwarf';
} elseif ($row['race'] == '5') {
$Race = 'Камаел';
} else {
$Race = "Human";
}
$name = $row['char_name'];
if ($row['sex'] == '0') {$Sex = 'Мужcкой';} else {$Sex = 'Женский';}
$Lvl = $row["level"];
$Class = $row["classname"];
$PVP = $row["pvpkills"];
$PK = $row["pkkills"];
$titles = $row['title'];
if ($online = $row["online"]==1) {$online='<font color=green>Online</font>'; }
else {$online='<font color=red>Offline</font>'; }
if ($clan = $clans_arr[$row['clanid']]) {
$ClanName = "<td class=TOnline1>Клан:</td><td class=TOnline>$clan</td></tr>";
if ($titles != '') {$TitleName = "<td class=TOnline1>Титле:</td><td class=TOnline>$titles</td></tr>";}
} else {
$ClanName = '';
$TitleName = '';
}
$onlinetimeH = 0;
$onlinetimeM = 0;
if ($row['onlinetime'] != '0') {
$onlinetimeH = round(($row['onlinetime']/60/60)-0.5);
$onlinetimeM = round(((($row['onlinetime']/60/60)-$onlinetimeH)*60)-0.5);
}
if ($onlinetimeH <= 0) {
$onlinetimeH = '??';
}
$timeonline = $onlinetimeH."&nbsp;ч.&nbsp;".$onlinetimeM."&nbsp;м.";
}

$strout = "<table width=100% border=0><tr>"
."<td width=30%>Имя:</td><td>$name</td></tr><tr>"
."<td>Раса:</td><td>$Race</td></tr><tr>"
."<td>Класс:</td><td>$Class</td></tr>"
."<td>Пол:</td><td>$Sex</td></tr>"
."<td>PVP/PK:</td><td>$PVP/$PK</td></tr>"
."".$ClanName.""
."".$TitleName.""
."<td>Играет:</td><td>$timeonline</td></tr>"
."<td>Левел:</td><td>$Lvl+</td></tr>"
."<td>Статус:</td><td>$online</td></tr>"
."</table>";
return $strout;
}
?>



<?php
$content = ob_get_contents();
ob_end_clean();
?>

  Ответить  
 
 автор: Николай2357   (08.09.2009 в 15:37)   письмо автору
 
   для: SOul   (08.09.2009 в 15:20)
 

Вот так надо сделать:
<?
$result 
mysql_query($sql$Server) or die (mysql_error() .'<br> SQL:'$sql);

  Ответить  
Rambler's Top100
вверх

Rambler's Top100 Яндекс.Метрика Яндекс цитирования