Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
new-turn [2018-03-23 10:41] Joakim Forsgren |
new-turn [2018-03-23 10:41] Joakim Forsgren |
||
---|---|---|---|
Line 2: | Line 2: | ||
Vi har bestämt att vi ska spara alla frågor som hör till ett game som en serialized array | Vi har bestämt att vi ska spara alla frågor som hör till ett game som en serialized array | ||
<code php> | <code php> | ||
+ | // Struktur på $game_questions. | ||
+ | |||
+ | $game_questions = [ | ||
+ | 0 => 31, | ||
+ | 1 => 17, | ||
+ | 2 => 8, | ||
+ | ]; | ||
+ | |||
serialize($game_questions) | serialize($game_questions) | ||
</ | </ | ||
Line 19: | Line 27: | ||
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)) { |