Web coding support
  • Home
  • PHP
  • Phonegap
  • Angular Js
  • Node Js
  • Previous year questions
  • B.Tech Questions
  • RTU

Magic function library for Codeigniter like CakePHP

  • By admin
  • Jan-29-2017
  • Codeigniter, oops, PHP
  • 0 Comments.
 Magic function library for Codeigniter like CakePHP

Magic functions list for CI

CodeIgniter is a powerful PHP framework with a very small footprint, and very useful for website.

Today I am going to introduce you the Magic function for CI like CakePHP.

What is Magic Functions

As the name “Magic function” there are some magic with its library which you can download from here .

By using this library, you don’t need to do define any function in your models all functions which you want it has already created just like magic. There is a library Magic.php which convert your function into Database Query and produce result as you want.

Clone the Magic.php in your local directory and place it into application/library in your CI project. Now set this library in application/config/autoload.php . so don’t need to load in every controller.

$autoload['library'] = array('Magic');

Now your magic library is ready to use with $this->magic instance.

Structure:

$this->magic Instance of library. ->tableName set table name for fetch data from DB. ->findAll($conditions=array()) Get all data from table.

Now the magic begin.

   $this->magic->tableName->findByTableColoumName($param);

Example

$this->magic->tableName->findById(2);
$this->magic->tableName->findByName('user');
$this->magic->tableName->findByUserName('user');
$this->magic->tableName->findByEmail('user@email.com');

Find All Results

$this->magic->tableName->findAll($conditions = array());

Count All Records

$this->magic->tableName->findCount($conditions = array());

Git repository : Download source code

Related Posts

  • Form validation in codeigniterForm validation in codeigniter
  • How to create pagination in PHP and MySQLHow to create pagination in PHP and MySQL
  • What is a difference between a method and a function?What is a difference between a method and a function?
  • What is the difference between an interface and abstract classWhat is the difference between an interface and abstract class
  • How to reset an array keys in phpHow to reset an array keys in php
  • How to handle duplicate data in MySqlHow to handle duplicate data in MySql

Share this:

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)
  • Click to share on Google+ (Opens in new window)
  • Click to share on Pinterest (Opens in new window)
  • Click to share on WhatsApp (Opens in new window)
  • Click to email this to a friend (Opens in new window)
  • Click to print (Opens in new window)

Related

FacebookTwitterGoogle+Google GmailPrintPinterestFacebook MessengerWordPressShare

Comments

Leave a Reply Cancel reply

← Previous Post Next Post →

Categories

  • Angular Js
  • Array
  • Codeigniter
  • facebook
  • Javascript
  • jquery
  • MySQL
  • oops
  • Pagination
  • Phonegap
  • PHP

Recent Posts

  • Fetch random results form MySQL
  • HTML DOM Manipulation using JavaScript
  • Magic function library for Codeigniter like CakePHP
  • What is the difference between an interface and abstract class
  • How to reset an array keys in php

Tags

Abstract Class angularjs array codeigniter facebook facebook login facebook sdk form validations function hide html Interface javascript jquery magic functions method mysql ng-hide ng-show nghide ngshow oops pagiation php recursion reference show static static functions

Subscribe us

Name
Email *
About This Site

We provide the simplest tutorials for web development.

Pages
  • Home
  • B.Tech Questions
  • Previous year questions
  • RTU
Categories
  • Angular Js
  • Array
  • Codeigniter
  • facebook
  • Javascript
  • jquery
  • MySQL
  • oops
  • Pagination
  • Phonegap
  • PHP
Search
  • facebook
  • twitter

Powered by Minmarks.com  |  A Coding blog by By Jitendra.

loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.