我尝试使用此代码$result = mysql_query("SELECT * FROM players_db WHERE revision=12 ORDER BY RAND() LIMIT 1", $link) or die(mysql_error($link));
对我挑选出数据库的玩家进行排序。它给出了以下结果:
@font-face {
font-family: 'Knul-Bold'; /*a name to be used later*/
src: url('http://jterweele.informatica.bc-enschede.nl/fonts/Knul/Knul-Bold.otf'); /*URL to font*/
}
@font-face {
font-family: 'Knul-Regular'; /*a name to be used later*/
src: url('http://jterweele.informatica.bc-enschede.nl/fonts/Knul/Knul-Regular.otf'); /*URL to font*/
}
.image {
position: relative;
width: auto;
}
.img {
position: absolute;
top: 43px;
left: 87.5px;
height: 110px;
width: 110px;
}
.possmaller {
left: 49px;
position: absolute;
top: 34px;
width: 10%;
font-family: 'Knul-Bold';
}
.pos {
left: 56px;
position: absolute;
top: 34px;
width: 10%;
font-family: 'Knul-Bold';
}
.rating {
position: absolute;
top: 0px;
left: 53px;
width: 10%;
font-size: 29px;
font-family: 'Knul-Bold';
}
.name {
position: absolute;
top: 135px;
width: 207.5px;
font-size: 20px;
text-align:center;
text-transform: uppercase;
font-family: 'Knul-Bold';
}
.pac {
position: absolute;
top: 161px;
left: 60px;
width: 10%;
font-family: 'Knul-Regular';
}
.dri {
position: absolute;
top: 161px;
left: 150px;
width: 10%;
font-family: 'Knul-Regular';
}
.sho {
position: absolute;
top: 185px;
left: 60px;
width: 10%;
font-family: 'Knul-Regular';
}
.pas {
position: absolute;
top: 209px;
left: 60px;
width: 10%;
font-family: 'Knul-Regular';
}
.def {
position: absolute;
top: 185px;
left: 150px;
width: 10%;
font-family: 'Knul-Regular';
}
.phy {
position: absolute;
top: 209px;
left: 150px;
width: 10%;
font-family: 'Knul-Regular';
}
.pacal {
position: absolute;
top: 161px;
left: 35px;
width: 10%;
font-family: 'Knul-Bold';
}
.drial {
position: absolute;
top: 161px;
left: 125px;
width: 10%;
font-family: 'Knul-Bold';
}
.shoal {
position: absolute;
top: 185px;
left: 35px;
width: 10%;
font-family: 'Knul-Bold';
}
.pasal {
position: absolute;
top: 209px;
left: 35px;
width: 10%;
font-family: 'Knul-Bold';
}
.defal {
position: absolute;
top: 185px;
left: 125px;
width: 10%;
font-family: 'Knul-Bold';
}
.phyal {
position: absolute;
top: 209px;
left: 125px;
width: 10%;
font-family: 'Knul-Bold';
}
.nation {
position: absolute;
top: 113px;
left: 46px;
height: auto;
width: 40px;
}
.clubbadge {
position: absolute;
top: 79px;
left: 46px;
width: 40px;
height: 40px;
}
.coins {
display: inline-block;
position: absolute;
top: 240px;
left: 90px;
width: 120px;
height: 40px;
}
.imm {
position: absolute;
top: 255px;
left: 65px;
width: 27px;
height: 29px;
}
.smaller {
font-size: 17px;
}
a.button {
-webkit-appearance: button;
-moz-appearance: button;
appearance: button;
text-decoration: none;
color: initial;
}
.gold1{
font-size: 13px;
text-shadow: 0 1px rgba(255,255,255,0.3);
font-family:"Knul-Bold", sans-serif;
color: #433111;
height: 280px;
margin-top: 0px;
width: 200px;
float: left;
}
<div id="spelers">
<a href="speler.php?id=2410"><div class="gold1" style="position:relative; cursor: pointer;margin-top: 20px;"><img class="image" src="http://jterweele.informatica.bc-enschede.nl/img/gold1.png" style="margin-left:7.5; margin-top: 2px;"><img class="img" src="http://futhead.cursecdn.com/static/img/16/players/170797.png" alt="Player Image" onerror="this.onError=null;this.src='http://futhead.cursecdn.com/static/img/16/players/170797.png'; this.onclick=null;"><img class="clubbadge" src="http://futhead.cursecdn.com/static/img/16/clubs/22.png" alt="Club Badge"><img class="nation" src="http://futhead.cursecdn.com/static/img/16/nations/48.png" alt="Nation Flag"><h2 class="pos">CM</h2><h2 class="name">Şahin</h2><h2 class="rating"> 81</h2><h2 class="pacal">54</h2><h2 class="pac">PAC</h2><h2 class="drial"> 81</h2><h2 class="dri">DRI</h2><h2 class="shoal">68</h2><h2 class="sho">SHO</h2><h2 class="pasal"> 84</h2><h2 class="pas">PAS</h2><h2 class="defal"> 69</h2><h2 class="def">DEF</h2><h2 class="phyal"> 61</h2><h2 class="phy">PHY</h2><img class="imm" src="http://wefut.com/assets/images/coins.png"><h2 class="coins">800</h2></div></a><a href="speler.php?id=3860"><div class="gold1" style="position:relative; cursor: pointer;margin-top: 20px;"><img class="image" src="http://jterweele.informatica.bc-enschede.nl/img/gold1.png" style="margin-left:7.5; margin-top: 2px;"><img class="img" src="http://futhead.cursecdn.com/static/img/16/players/186115.png" alt="Player Image" onerror="this.onError=null;this.src='http://futhead.cursecdn.com/static/img/16/players/186115.png'; this.onclick=null;"><img class="clubbadge" src="http://futhead.cursecdn.com/static/img/16/clubs/1.png" alt="Club Badge"><img class="nation" src="http://futhead.cursecdn.com/static/img/16/nations/14.png" alt="Nation Flag"><h2 class="pos">LB</h2><h2 class="name">Gibbs</h2><h2 class="rating"> 80</h2><h2 class="pacal">81</h2><h2 class="pac">PAC</h2><h2 class="drial"> 77</h2><h2 class="dri">DRI</h2><h2 class="shoal">57</h2><h2 class="sho">SHO</h2><h2 class="pasal"> 72</h2><h2 class="pas">PAS</h2><h2 class="defal"> 80</h2><h2 class="def">DEF</h2><h2 class="phyal"> 72</h2><h2 class="phy">PHY</h2><img class="imm" src="http://wefut.com/assets/images/coins.png"><h2 class="coins">850</h2></div></a><a href="speler.php?id=3945"><div class="gold1" style="position:relative; cursor: pointer;margin-top: 20px;"><img class="image" src="http://jterweele.informatica.bc-enschede.nl/img/gold1.png" style="margin-left:7.5; margin-top: 2px;"><img class="img" src="http://futhead.cursecdn.com/static/img/16/players/186561.png" alt="Player Image" onerror="this.onError=null;this.src='http://futhead.cursecdn.com/static/img/16/players/186561.png'; this.onclick=null;"><img class="clubbadge" src="http://futhead.cursecdn.com/static/img/16/clubs/1.png" alt="Club Badge"><img class="nation" src="http://futhead.cursecdn.com/static/img/16/nations/50.png" alt="Nation Flag"><h2 class="pos">CM</h2><h2 class="name">Ramsey</h2><h2 class="rating"> 82</h2><h2 class="pacal">69</h2><h2 class="pac">PAC</h2><h2 class="drial"> 80</h2><h2 class="dri">DRI</h2><h2 class="shoal">78</h2><h2 class="sho">SHO</h2><h2 class="pasal"> 79</h2><h2 class="pas">PAS</h2><h2 class="defal"> 68</h2><h2 class="def">DEF</h2><h2 class="phyal"> 76</h2><h2 class="phy">PHY</h2><img class="imm" src="http://wefut.com/assets/images/coins.png"><h2 class="coins">1300</h2></div></a></div>
但是我希望它在rand()命令之后对'rating'(我的数据库中的列)进行排序,所以Ramsey应该是第一个,因为他的'评级'是82.我希望有人可以帮助我!! / p>