Download the PHP package octa-php/octa-orm without Composer
On this page you can find all versions of the php package octa-php/octa-orm. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download octa-php/octa-orm
More information about octa-php/octa-orm
Files in octa-php/octa-orm
Package octa-orm
Short Description an advance PHP-PDO ORM database class used by octaphp framework
License MIT
Informations about the package octa-orm
OctaORM
Is an advance PHP-PDO ORM database class used by OctaPHP framework. This database class is inspired by codeigniter active record.
Powered By

Author
Getting Started
installing via composer.
Prerequisites
How To Use
Open file and modify this variables below
Require the file in your project.
Documentation
$db->get(); And $db->result();
Runs the selection query and returns an array of result.
The second and third parameters of enable you to set a limit and offset clause:
You'll notice that the above function is assigned to a variable named $query, which can be used to show the results:
$db->get(); And $db->row();
Runs the selection query and returns a row of data.
You'll notice that the above function is assigned to a variable named $query, which can be used to fetch the row:
$db->get(); And $db->num_rows();
Permits you to determine the number of rows in a particular table.
You'll notice that the above function is assigned to a variable named $query, which can be used to fetch the row:
$db->last_query(); (for sql debugging)
Permits you to determine the last query which was run
$db->select();
Permits you to write the SELECT portion of your query:
$db->select() accepts an optional second parameter. If you set it to FALSE, OctaPHP will not try to protect your field or table names with backticks. This is useful if you need a compound select statement.
$db->join();
Permits you to write the JOIN portion of your query:
Multiple function calls can be made if you need several joins in one query.
If you need a specific type of JOIN you can specify it via the third parameter of the function. Options are: left, right, outer, inner, left outer, and right outer.
$db->where();
This function enables you to set WHERE clauses using one of four methods:
-
Simple key/value method:
Notice that the equal sign is added for you. If you use multiple function calls they will be chained together with AND between them: -
Custom key/value method:
You can include an operator in the first parameter in order to control the comparison: -
Associative array method:
You can include your own operators using this method as well: - Custom string:
You can write your own clauses manually:
$db->where()
accepts an optional third parameter. If you set it to FALSE, OctaPHP will not try to protect your field or table names with backticks.
$db->or_where();
This function is identical to the one above, except that multiple instances are joined by OR:
$db->where_in();
Generates a WHERE field IN ('item', 'item') SQL query joined with AND if appropriate
$db->or_where_in();
Generates a WHERE field IN ('item', 'item') SQL query joined with OR if appropriate
$db->where_not_in();
Generates a WHERE field NOT IN ('item', 'item') SQL query joined with AND if appropriate
$db->or_where_not_in();
Generates a WHERE field NOT IN ('item', 'item') SQL query joined with OR if appropriate
$db->like();
This function enables you to generate LIKE clauses, useful for doing searches.
- Simple key/value method:
If you use multiple function calls they will be chained together with AND between them:
If you want to control where the wildcard (%) is placed, you can use an optional third argument. Your options are 'before', 'after' and 'both' (which is the default).
If you do not want to use the wildcard (%) you can pass to the optional third argument the option 'none'.
- Associative array method:
$db->or_like();
This function is identical to the one above, except that multiple instances are joined by OR:
$db->not_like();
This function is identical to like(), except that it generates NOT LIKE statements:
$db->or_not_like();
This function is identical to not_like(), except that multiple instances are joined by OR:
$db->group_by();
Permits you to write the GROUP BY portion of your query:
You can also pass an array of multiple values as well:
$db->order_by();
Lets you set an ORDER BY clause. The first parameter contains the name of the column you would like to order by. The second parameter lets you set the direction of the result. Options are asc or desc, or random.
You can also pass your own string in the first parameter:
Or multiple function calls can be made if you need multiple fields.
$db->insert();
Generates an insert string based on the data you supply, and runs the query. You can either pass an array or an object to the function. Here is an example using an array:
The first parameter will contain the table name, the second is an associative array of values. Here is an example using an object:
The first parameter will contain the table name, the second is an object.
Note: All values are escaped automatically producing safer queries.
$db->insert_batch();
Generates an insert string based on the data you supply, and runs the query. You can either pass an array or an object to the function. Here is an example using an array:
The first parameter is an associative array of values, the second will contain the table name.
Note: All values are escaped automatically producing safer queries.
$db->update();
Generates an update string and runs the query based on the data you supply. You can pass an array or an object to the function. Here is an example using an array:
$db->update_batch();
Generates an update string based on the data you supply, and runs the query. You can either pass an array or an object to the function. Here is an example using an array:
The first parameter will contain the table name, the second is an associative array of values, the third parameter is the where key.
Note: All values are escaped automatically producing safer queries.
$db->delete();
Generates a delete SQL string and runs the query.
The first parameter is the table name, the second is the where clause. If you want to delete multiple data from a table, the second parameter must be an array of ID's
$db->delete_all();
This will wipe all the data of a table
Example Of Queries Using OctaPHP Active Record
LIST OF PRE-DEFINED CLASS
License
- MIT
- Copyright 2019 � OctaORM.
Acknowledgments
- RedBeanPHP
Support
Reach me out on this social media site.
Linkedin.com