gomymobi.com: Knowledge Base

Database

You may use our built-in database class in anywhere in your files. Our built-in class also support prepared statements.

Database table variables

Database built-in class

- We already develop a built-in class and pre-defined object of database class, it's $db, you only use this object to connect to database for all tasks: SELECT, INSERT, UPDATE and DELETE.

- In this tutorial, we will guide you all basic methods to work with database via this object


Select from table with your conditions. This method also supports prepared statements.

$table_name name of table need to query

$fields name of fields need to retrieve, separated by comma (,)

$conditions your query conditions

$more custom additional query, such as ORDER and LIMIT, or values for prepared statements

$prepared_value values for prepared statements; single value or array of values

Return: Array / NULL

Example: select all plans and show to homepage

Example: get all details of an user by using prepared statement


Insert a new record into table. This method also supports prepared statements.

$table_name name of table need to insert

$values_array array of values with key as fields for inserting

$fields_array array of fields if $values_array is just array of values

$more values for prepared statements; single value or array of values

Return: TRUE / FALSE

Example: insert a new frontpage

Example: insert a new frontpage using prepared statements


Update a record in table. This method also supports prepared statements.

$table_name name of table need to update

$states array of values with key as fields for updating

$conditions your updating conditions

$more values for prepared statements; single value or array of values

Return: TRUE / FALSE

Example: update a frontpage

Example: update a frontpage using prepared statements


Delete a record from table. This method also supports prepared statements.

$table_name name of table need to update

$conditions your updating conditions

$more values for prepared statements; single value or array of values

Return: TRUE / FALSE

Example: delete a frontpage

Example: delete a frontpage using prepared statements


Retrieve results after you performed a SELECT query.

$return_1 set this parameter is TRUE if you would like to retrieve first one record.

Return: Array / NULL

Example: select all active frontpages

Example: select all active frontpages but get first one


Retrieve value of ID after you performed a INSERT query.

Return: FALSE / ID value



don't hesitate to contact us if your thing is outside of this section
by using contact button above or send directly to hello@gomymobi.com with subject: [contactgmm]
if could not receive our reply within 24 hours, please resend ticket again