Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision Next revision Both sides next revision | ||
new-turn [2018-03-02 14:18] Joakim Forsgren created |
new-turn [2018-03-23 10:41] Joakim Forsgren |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== e=new-turn ====== | ====== e=new-turn ====== | ||
+ | Vi har bestämt att vi ska spara alla frågor som hör till ett game som en serialized array | ||
+ | <code php> | ||
+ | serialize($game_questions) | ||
+ | </ | ||
Utöver detta nedan måste man göra vissa kollar, typ att det inte redan finns 18 frågor mm | Utöver detta nedan måste man göra vissa kollar, typ att det inte redan finns 18 frågor mm | ||
Line 16: | Line 19: | ||
2. Slumpla fram 3 nya frågor och lägg till dessa till $game_questions | 2. Slumpla fram 3 nya frågor och lägg till dessa till $game_questions | ||
<code php> | <code php> | ||
+ | // Struktur på $game_questions. | ||
+ | |||
+ | $game_questions = [ | ||
+ | 0 => 31, | ||
+ | 1 => 17, | ||
+ | 2 => 8, | ||
+ | ]; | ||
+ | |||
+ | |||
while ($row = mysqli_fetch_assoc($result)) { | while ($row = mysqli_fetch_assoc($result)) { | ||
$game_questions[] = $row[' | $game_questions[] = $row[' |