PHP Classes

File: create.php

Recommend this page to a friend!
  Classes of Ahmad Mustapha   Simple React PHP CRUD   create.php   Download  
File: create.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: 3 years ago
Size: 492 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->create('Carliedu', 'clu.123')
    ->
then(function (QueryResult $queryResult) use ($user) {
        echo(
"\nUser created successfully\nUserID: {$queryResult->insertId}.\n");
       
$user->getConnection()->close();
    })
    ->
otherwise(function (Throwable $exception) {
        echo
$exception;
    });

$loop->run();