Pereiti prie turinio

Vienos eilutės išskyrimas.


Rekomenduojami pranešimai

Sveiki, taigi turiu lentelę kurią sudaro 7 stulpeliai ir daug eilučių (virš 100), Dabar puslapis atrodo taip:

 

post-34278-073660800 1304872625_thumb.png

 

Norėčiau padaryti viršuje eilutę, kurioje būtų rodoma viena eilutė iš tos lentelės, o tą eilutę atsekti pagal IP, visa informacija saugoma mysql'e.

 

Norėčiau jog būtų:

 

post-34278-012171400 1304872691_thumb.png

 

Viršuje rodytų eilutę, kur atitinka žmogaus žiūrinčio puslapį IP su mysql'e IP. O Jei to IP nėra, tada tiesiog rodytų kokią žinutę.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Statistics</title>
<link href="tablecloth/tablecloth.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript" src="tablecloth/tablecloth.js"></script>
</head>
<style>
.red {
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
color: #ff0000;
}
.blue {
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
color: #00F;
}
.green {
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
color: #0C0;
}
.default {
font-family: Arial, Helvetica, sans-serif;
color: #000;
}

.heading {
font-family: Arial, Helvetica, sans-serif;
font-style: italic;
font-weight: lighter;
color: #fff;
text-align: left;
}
.sth {
font-family: Arial, Helvetica, sans-serif;
font-style: italic;
font-weight: lighter;
color: #fff;
text-align: center;
}
.sth2 {
font-family: Arial, Helvetica, sans-serif;
color: #000;
text-align: center;
}
</style>
<body>
<div align="center">
<br />
<?php
$username="root";
$password="";
$database="users";

mysql_connect("localhost",$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM rank ORDER BY skill DESC";
$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();
?>
<table style="" border="0" cellspacing="15" cellpadding="1">
<tr>
<th class="heading" width="10">#</th>
<th class="heading" width="15"></th>
<th class="heading" width="250">Name</th>
<th class="sth">Kills</th>
<th class="sth">Deaths</th>
<th class="sth">Headshots</th>
<th class="sth">Skill</th>
</tr>

<?php
$i=0;
while ($i < $num) {
$ip=mysql_result($result,$i,"ip");
$f1=mysql_result($result,$i,"name");
$f2=mysql_result($result,$i,"kills");
$f3=mysql_result($result,$i,"deaths");
$f4=mysql_result($result,$i,"headshots");
$f5=mysql_result($result,$i,"skill");
$country=mysql_result($result,$i,"country");
$steam=mysql_result($result,$i,"steam");

if($i+1==1) $class="red";
if($i+1==2) $class="blue";
if($i+1==3) $class="green";
if($i+1>3) $class="default";


$salis = strtolower($country);

?>

<tr>
<td class="<?php echo $class ?>"><?php echo $i+1;?></td>

<td class="default" colspan="1"><img src="<?php echo "flags/$salis.png"?>" alt="<?php echo "$country flag"?>"/></td>
<td class="default" width="150"><?php 
if($steam==1) 
echo "<img src=\"img/VIP.png\" alt=\"Very Important Person\" width=\"15\" height=\"15\" />";
elseif($steam==2)
echo "<img src=\"img/ADMIN.png\" alt=\"Administrator\" width=\"15\" height=\"15\" />";
else
echo "<img src=\"img/blank.png\" alt=\"Player\" width=\"15\" height=\"15\" />";

echo $f1; ?></td>
<td class="sth2"><?php echo $f2; ?></td>
<td class="sth2"><?php echo $f3; ?></td>
<td class="sth2"><?php echo $f4; ?></td>
<td class="sth2"><?php echo $f5; ?></td>
</tr>
<?php
$i++;
}
?>
</table>
</div>
</body>
</html>

 

O mysql'as atrodo taip:

 

post-34278-089128300 1304872933_thumb.png

Nuoroda į pranešimą
Dalintis kituose puslapiuose

Prisijunkite prie diskusijos

Jūs galite rašyti dabar, o registruotis vėliau. Jeigu turite paskyrą, prisijunkite dabar, kad rašytumėte iš savo paskyros.

Svečias
Parašykite atsakymą...

×   Įdėta kaip raiškusis tekstas.   Atkurti formatavimą

  Only 75 emoji are allowed.

×   Nuorodos turinys įdėtas automatiškai.   Rodyti kaip įprastą nuorodą

×   Jūsų anksčiau įrašytas turinys buvo atkurtas.   Išvalyti redaktorių

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

Įkraunama...
  • Dabar naršo   0 narių

    Nei vienas registruotas narys šiuo metu nežiūri šio puslapio.

×
×
  • Pasirinkite naujai kuriamo turinio tipą...