PHP Classes

File: list.php

Recommend this page to a friend!
  Classes of Ahmad Mustapha  >  Simple React PHP CRUD  >  list.php  >  Download  
File: list.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Simple React PHP CRUD
Manipulate records in a page done using ReactPHP
Author: By
Last change:
Date: 9 months ago
Size: 588 bytes
 

Contents

Class file image Download
<?php

use Crud\User;
use
React\EventLoop\Factory;
use
React\MySQL\QueryResult;

require
'vendor/autoload.php';

$loop = Factory::create();

$user = new User($loop);

$user->list()->then(function (QueryResult $queryResult) use ($user) {
    foreach (
$queryResult->resultRows as $resultRow) {
        echo
"
            ID:
{$resultRow['id']}
            Name:
{$resultRow['username']},
            Code:
{$resultRow['userCode']}
            Time:
{$resultRow['time']}
        "
;
    }
})
    ->
otherwise(function (Throwable $exception) {
        echo
$exception;
    });

$loop->run();

For more information send a message to info at phpclasses dot org.