forked from yanvolo/chalk_it_up
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist_my_decks.php
More file actions
28 lines (24 loc) · 915 Bytes
/
list_my_decks.php
File metadata and controls
28 lines (24 loc) · 915 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
require "library.php";
needUserInfo();
if($logged_in === FALSE){die('not logged in');}
$res = runSql('get_decks', 'SELECT * FROM deck WHERE owner = $1;', array($uid)) or die('failed to get decks');
if(pg_num_rows($res) == 0){
echo 'you have no decks';
}
for($i = 0; $i < pg_num_rows($res); $i++){
$row = pg_fetch_assoc($res, $i);
echo 'Name: '.$row['display_name'].'<br/>
Description: '.$row['description'].'<br/>';
$cardids = str_getcsv($row['questionids_csv']);
foreach($cardids as $cardid){
$res2 = runSql1('get_answer', 'SELECT * FROM card WHERE cardid = $1;', array($cardid)) or die('failed to get card id:'.$cardid);
echo 'Card Title: '.$res2['short'].'<br/>
Card Body: '.$res2['long'].'<br/>';
$answers = str_getcsv($res2['answers_csv']);
foreach($answers as $answer){
echo $answer.'<br/>';
}
}
echo '<br/>';
}