PHP Classes

File: test/insert.php

Recommend this page to a friend!
  Packages of Boss Ibrahim Mussa   Wepesi PHP ORM Framework   test/insert.php   Download  
File: test/insert.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Wepesi PHP ORM Framework
Execute common SQL queries using object functions
Author: By
Last change:
Date: 4 years ago
Size: 391 bytes
 

Contents

Class file image Download
<?php
$db=$db??[];
$field = [
    "userid" => 1,
    "message" => "hello from wepesi",
    "datecreated" => date('Y-m-d H:i:s',strtotime("now"))
];
try {
    $db->insert("message")->field($field)->result();
    if($db->error()){
        throw new \Exception($db->error());
    }
    var_dump(["last insert ID : "=>$db->lastId()]);
} catch (Exception $e) {
    var_dump($e->getMessage());
}