Documentation
Start here to install Medoo and create your first database connection in minutes.
Setup
Install Medoo and create your first database connection.
Framework Integration
Learn how to integrate Medoo with popular PHP frameworks.
This guide explains Medoo's $where argument, which many methods use for filtering. Understanding it is essential for retrieving exactly the data you need.
Browse the full Medoo API reference.
select
Retrieve data from a table.
insert
Insert one or more records into a table.
update
Update records in a table.
delete
Delete records from a table.
replace
Replace records in a table. Existing records with a matching primary key are deleted and reinserted; otherwise, a new record is inserted.
create
Create a new table.
drop
Drop an existing table.
get
Retrieve a single record from a table.
has
Check whether any matching record exists in a table.
count
Count matching rows in a table.
max
Return the maximum value of a column.
min
Return the minimum value of a column.
avg
Calculate the average value of a column.
sum
Calculate the sum of values in a column.
rand
Retrieve a random set of records from a table.
id
Return the ID of the last inserted row.
query
Execute a custom raw SQL query.
raw
Medoo provides raw expressions for complex and highly customizable queries. Raw expressions also support placeholders to prevent SQL injection, plus shortcut syntax for identifier quoting.
quote
Quote a string for use in a query.
action
Run queries inside a transaction.
debug
Enable debug mode to print the generated SQL without executing it.
log
Return the executed query log.
last
Return the last executed query.
info
Return information about the current database connection.