BUGFIX: fixed bug in getting randomnumbers from a previous game
authorArun Persaud <arun@nubati.net>
Mon, 25 Jun 2007 09:44:30 +0000 (11:44 +0200)
committerArun Persaud <arun@nubati.net>
Mon, 25 Jun 2007 09:44:30 +0000 (11:44 +0200)
DB querry was missing a column

db.php
functions.php

diff --git a/db.php b/db.php
index 1c20b8e2051272b685e055e41d9709ee7256c2a7..bae70cbc943b7273f4478bce795c0d64871bb34c 100644 (file)
--- a/db.php
+++ b/db.php
@@ -771,9 +771,9 @@ function DB_get_PREF($myid)
 
 function DB_get_unused_randomnumbers($userstr)
 {
-  $queryresult = mysql_query("SELECT randomnumbers,Game.id FROM Game ".
+  $queryresult = mysql_query("SELECT randomnumbers,Game.id, COUNT(*) as num FROM Game ".
                             "  LEFT JOIN Hand ON Hand.game_id=Game.id ".
-                            "                 AND  user_id not in (".$userstr.")".
+                            "                 AND user_id not in (".$userstr.")".
                             "  GROUP BY  Game.id ".
                             "  HAVING num=4");
   
index deadf34fdb03ea93fc61637ee4f1298bfea85b05..e30c81753fc74485eb301f174f5fa07d48d32e64 100644 (file)
@@ -309,7 +309,7 @@ function  create_array_of_random_numbers($useridA,$useridB,$useridC,$useridD)
       /* check if we can find a game were non of the player was involved and return 
        * cards insted 
        */
-      $userstr = implode(",",array($useridA,$useridB,$useridC,$useridD));
+      $userstr = "'".implode("','",array($useridA,$useridB,$useridC,$useridD))."'";
       $randomnumbers = DB_get_unused_randomnumbers($userstr);
       $randomnumbers = explode(":",$randomnumbers);