PHP code example of litto / mysql

1. Go to this page and download the library: Download litto/mysql 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/ */

    

litto / mysql example snippets



class User extends MySql{

// Adding Record

function addrecord($inputs){
                $insert	=	array(	'name'=>$inputs['name'],'tel'=>$inputs['tel'],'email'=>$inputs['email']);
		$this->insert($insert,"cms_user");	
		return true;
	}

//Update Record

	function updateContent($inputs){
		$insert	=	array(	'name'=>$inputs['name'],'tel'=>$inputs['tel'],'email'=>$inputs['email']);
		$this->update($insert,"cms_user",'`id`='.$inputs['id']);
		return true;
	}

//Get all records

	function getall(){
		$query	=	'SELECT * FROM `cms_user` ';
		$rec	=	$this->fetchAll($query);
		return $rec;
	}

//Get details of Record

function getrecord($id){
		$query	=	'SELECT * FROM `cms_user` WHERE `id`='.$id.' ';
		$rec	=	$this->fetchAll($query);
		return $rec;
	}

//Delete record

function deleterecord($id){
$this->delete('cms_user','`id`='.$id);
}


}