}
if ($result = @mysqli_query($cnxn, $sql)) {
    foreach ($result as $row) {
        //Bold vocab word in example sentence and word in use sentence.
        $card_id = $row['card_id'];
        $word_in_use = str_ireplace($row['word'], "<u>" . $row['word'] . "</u>", $row['word_in_use']);
        $example_sentence = str_ireplace($row['word'], "<u>" . $row['word'] . "</u>", $row['example_sentence']);
        $word = $row['word'];
        $part_of_speech = $row['part_of_speech'];
        $chapter = $row['chapter'];
        $pg = $row['page_number'];
        $definition = $row['definition'];
        $grade = $row['grade'];
        $comment = $row['comment'];
        $previous = checkPrevious($card_id, $cnxn, $checkUser);
        $next = checkNext($card_id, $cnxn, $checkUser);
    }
} else {
    echo "<h1>No cards found!</h1>";
    die;
}
function checkPrevious($id, $cnxn, $user)
{
    //echo "<h1>Getting previous</h1>";
    //get the card_id of the previous card
    $p_sql = "SELECT card_id FROM cards WHERE user_id = {$user} AND is_visible = TRUE AND card_id < {$id} ORDER BY card_id DESC LIMIT 1";
    if ($p_result = mysqli_query($cnxn, $p_sql)) {
        foreach ($p_result as $p_row) {
            $previous = $p_row['card_id'];
            //echo "<h1>Previous: " . $previous . "</h1>";
        }
Exemple #2
0
if ($_SESSION["lastQueryArray"]["filas"] == "25") {
    echo "selected";
}
echo '>25</option>
    <option value="50"';
if ($_SESSION["lastQueryArray"]["filas"] == "50") {
    echo "selected";
}
echo '>50</option>
    <option value="100"';
if ($_SESSION["lastQueryArray"]["filas"] == "100") {
    echo "selected";
}
echo '>100</option>
</select>
<input type="submit" name="search" value="BUSCAR">
</form>';
//var_dump($preguntas);
echo "<ol>";
foreach ($preguntas as $preg) {
    echo '<a href="?p=edit&preg=' . $preg["id"] . '"><li>' . $preg["pregunta"] . '</li></a>';
}
echo "</ol>";
echo "<form method='post' action='#'>";
if (checkPrevious()) {
    echo "<input type='submit' name='previous' value='ANTERIOR'/>";
}
if (checkNext()) {
    echo "<input type='submit' name='next' value='SIGUIENTE'/>";
}
echo "</form>";