Re: card game event reporter
We exist to help people. I'm sorry, but our volunteer contributions don't extend to writing massive amounts of code methods for people who have done almost nothing.
If you have a more concrete setup available, perhaps you could share that code. Then we could assist further.
Re: card game event reporter
Quote:
Originally Posted by
PeejAvery
We exist to help people. I'm sorry, but our volunteer contributions don't extend to writing massive amounts of code methods for people who have done almost nothing.
If you have a more concrete setup available, perhaps you could share that code. Then we could assist further.
i understand that i wasnt hoping for loads of doe to be posted for me i was hoping for some sample sippets on how to do certain bits in it as i have only just started workin with php and was getting abit lost in it all. i appologise for any misunderstanding.
i have gotten the roughs basis for the pairings sorted for the initail start up of the "event" as such but the following rounds has got me puzzled. my code so far for the pairings is
Code:
<?php
// Display records from the table
$sql = "SELECT * FROM members where picked='0'";
echo "<table border='1'>";
do {
// Select records from the DB
$query = "SELECT * FROM members WHERE Online='1' AND picked='0'
ORDER BY Rand() LIMIT 2";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
echo "<tr><td>$row[3]</td>";
mysql_query("update members set picked='1' where login='$row[3]'") or die(mysql_error());
}
// Display records from the table
echo "<table border='1'>";
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
echo "<td>$row[3]</td>";
mysql_query("update members set picked='1' where login='$row[3]'") or die(mysql_error());
}
echo"</tr>";
} while ($Result = mysql_query($sql));
echo "</table>";
?>
which as i said above works for the 1st round pairings but after round one some players will have a win and need to be pair against each other and the same for players with a loss a code snippet on how to do this would be helpfull as i would assume that this could just go inside an if statment or would there be an easier way than that??
Re: card game event reporter
You should have a column for the games played as well. That way you can reference the last game to see if it was a win/loss. If you have that data in your database, then adding a simple WHERE clause will give you the results.
Re: card game event reporter
in the mySQl table i have got colums for "win", "loss"and "draw" of which with each round the wins get added to the relevent ones and was thinking if possible do and if statment which will reference a mysqul_query with a where clause in it. i think i know how to write this (and hope i wont get any errors). also is there a way to set what "member ids" or "logins" a certain player has played against??? thank you for all you help
Re: card game event reporter
You should have an additional table for game data. I accidentally said column, but meant table. That way you can reference the latest matches and figure out the winners. It should have the following columns.
- game_id
- timestamp
- player_1_id (match with user's table)
- player_2_id (match with user's table)
- winner_id (match with user's table)
Re: card game event reporter
Quote:
Originally Posted by
PeejAvery
You should have an additional table for game data. I accidentally said column, but meant table. That way you can reference the latest matches and figure out the winners. It should have the following columns.
- game_id
- timestamp
- player_1_id (match with user's table)
- player_2_id (match with user's table)
- winner_id (match with user's table)
thaks for clearing that up. i would assume that i could use the generation code in the above post to generate and then link said login id to the player1/2 columns.