summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--db.php4
-rw-r--r--functions.php2
2 files changed, 3 insertions, 3 deletions
diff --git a/db.php b/db.php
index 1c20b8e..bae70cb 100644
--- 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");
diff --git a/functions.php b/functions.php
index deadf34..e30c817 100644
--- a/functions.php
+++ b/functions.php
@@ -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);