Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are database escape() and quote() used for?

Tags:

joomla

I looked at some joomla components and there are functions like

$db->escape()
$db->quote()

What are they used for ?

Thanks

like image 262
abdel Avatar asked Apr 08 '13 18:04

abdel


1 Answers

Thes escape function is used to escape bad characters in order to protect against SQL injection.

The quote* functions are used to quote strings, because different database dialects have different quoting characters.

So depending on the database system you use, Joomla will choose the appropriate quoting characters.

like image 66
epicdev Avatar answered Oct 03 '22 00:10

epicdev