PHP code example of taylor-hawkes / tays-orm

1. Go to this page and download the library: Download taylor-hawkes/tays-orm library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

taylor-hawkes / tays-orm example snippets


$user=new \TModel\Users();
$user->first_name="taylor";
$user->last_name="hawkes";
$user->save();

$user=new \TModel\Users();
$user->fetchRow("1");// 1 is the value of the tables primary key
$user->last_name="Malone"; // I got married and was forced to take my wifes name
$user->save();

$user=new \TModel\Users();
$user->fetchRowWhere("first_name = 'taylor' and lastname ='hawkes'");
$user->last_name="Malone"; 
$user->save();

$user=new \TModel\Users();
$all_users= $user->fetchAssoc("select * from users");

$user=new \TModel\Users();
$do_something_else=$user->query("update users set ...");
sh
php generate_model.php --table="users" --host="database_ip" --user="db_user" --pass="db_pass" --database="db_name" --table="tablename"