Ben garip bir sorun var. Ben bu komut dosyasını çalıştırdığınızda ben veritabanından 10 kayıtları olsun ama hepsi tam aynıdır. Ben yanlış ya da nasıl düzeltebilirim yapıyorum hiçbir fikrim yok. Lütfen bana yardımcı olun.
Ben tablolar AMCMS_highscores, AMCMS_users, ben AMCMS_highscores tablo içinde bakmak istiyorum AMCMS_games, son 10 kayıtları almak var ama alan gameid örneğin 1997 sadece burada. Herhangi bir yardım takdir edilmektedir.
$data = query("SELECT `AMCMS_highscores`.`primkey` , `AMCMS_highscores`.`gameid` , `AMCMS_highscores`.`score` , `AMCMS_users`.`username` , `AMCMS_highscores`.`status` , `AMCMS_highscores`.`userkey` , `AMCMS_games`.`primkey` , `AMCMS_games`.`gamename` FROM `AMCMS_highscores` , `AMCMS_games` , `AMCMS_users` WHERE `AMCMS_highscores`.`gameid` = '$gameid' AND `AMCMS_highscores`.`userkey` != `AMCMS_users`.`userkey` AND `AMCMS_highscores`.`gameid` = `AMCMS_games`.`primkey` AND `AMCMS_highscores`.`status`= 'approved' ORDER by `AMCMS_highscores`.`primkey` DESC LIMIT 0, 10");
Print "<table border cellpadding=3>";
while($info = mysql_fetch_array( $data )) {
Print "<tr>";
Print "<th>Score:</th> <td>".$info['score'] . "</td> ";
Print "<th>ID:</th> <td>".$info['userkey'] . " </td></tr>"; }
Print "</table>";
İşte sorgu biçimlendirilmiş versiyonu:
SELECT
`AMCMS_highscores`.`primkey` , `AMCMS_highscores`.`gameid` ,
`AMCMS_highscores`.`score` , `AMCMS_users`.`username` ,
`AMCMS_highscores`.`status` , `AMCMS_highscores`.`userkey` ,
`AMCMS_games`.`primkey` , `AMCMS_games`.`gamename`
FROM `AMCMS_highscores` , `AMCMS_games` , `AMCMS_users`
WHERE `AMCMS_highscores`.`gameid` = '$gameid'
AND `AMCMS_highscores`.`userkey` != `AMCMS_users`.`userkey`
AND `AMCMS_highscores`.`gameid` = `AMCMS_games`.`primkey`
AND `AMCMS_highscores`.`status`= 'approved'
ORDER by `AMCMS_highscores`.`primkey` DESC
LIMIT 0, 10
OOPS, i didnt mean to copy that but i did by accident. When its with "=" sign (highscores.userkey = users.userkey) i get empty query so that didnt fix it :(
Bu sorgu anlamak daha kolay olurdu umut :)
SELECT highscores.primkey, highscores.gameid, highscores.score, users.username,
highscores.status, highscores.userkey, games.primkey, games.gamename
FROM AMCMS_highscores AS highscores, AMCMS_games as games, AMCMS_users as users
WHERE highscores.gameid = '$gameid' AND
highscores.status = 'approved'
ORDER by highscores.primkey DESC LIMIT 0, 10
İşte sonuç:
http://www.gamesorbiter.com/FB_app/play.php?gameid=1997 (under the game)
Bunu yayınlamak zaman Btw, nasıl size sorgu kod? Ben kod düğmesini tıkladım ve kod sadece ilk satırı kodlanmış var.