catfan / Medoo

The lightweight PHP database framework to accelerate the development.
https://medoo.in
MIT License
4.83k stars 1.15k forks source link

cannot get prefix from the object to use in query function #887

Closed infernusec closed 3 years ago

infernusec commented 4 years ago

im trying to get the prefix name from the object, but the object are protected, so i cannot do it. i need it to run custom query, i need something like that:

$db -> query('TRUNCATE '.$db -> prefix.'sessions'); any solution?

catfan commented 4 years ago

You can use quotation syntax <table.column> for the query, and Medoo will handle the prefix and quotation automatically.

https://medoo.in/api/query

infernusec commented 4 years ago

You can use quotation syntax <table.column> for the query, and Medoo will handle the prefix and quotation automatically.

https://medoo.in/api/query

but its truncate.. so i need to do something like this?

$db -> query('TRUNCATE < sessions >');