DemoRegister::showRecords PHP Method

showRecords() public method

Displays the records
public showRecords ( )
    public function showRecords()
    {
        // Displays the records if there
        if (self::$hasRecords) {
            $html = null;
            foreach (self::$hasRecords as $row) {
                $html .= '<div>- #' . $row['id'] . ' ' . ucwords($row['firstname']) . ' ' . ucwords($row['lastname']) . ($row['mail'] ? ' [' . $row['mail'] . ']' : NULL) . '</div>';
            }
            return $html;
        } else {
            return '<div>No record at the time.</div>';
        }
    }

Usage Example

示例#1
0
        <div><?php 
echo $demo::FIRST_NAME;
?>
: <input type="text" name="firstname" /></div>
        <div><?php 
echo $demo::LAST_NAME;
?>
: <input type="text" name="lastname" /></div>
        <div><?php 
echo $demo::MAIL;
?>
: <input type="text" name="mail" /></div>
        <div><input type="submit" value="Register" /></div>
    </form>

    <?php 
echo $demo->getMessage();
?>

    <?php 
echo $demo::TOTAL_USERS;
?>
: <?php 
echo $demo->getTotalOfRecords();
?>

    <?php 
echo $demo->showRecords();
?>
</div>