escaping strings for SQLite3 in PHP5

前端 未结 1 1677
傲寒
傲寒 2021-01-19 16:31

Why does both functions fail me? Or is this just an illusion?



        
1条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-19 17:26

    You should be using PDO to access your database because it has prepared statements which are safer than escaping and also faster.

    The PHP Data Objects (PDO) extension defines a lightweight, consistent interface for accessing databases in PHP. Each database driver that implements the PDO interface can expose database-specific features as regular extension functions.

    Another big adventage when using PDO is that you can switch between databases(MySQL vs PostGRESQL vs SQLite for example) easily without changing much of your code.

    A quick introduction how to use PDO can be read over at nettuts. A very good read/introduction if you ask me!

    0 讨论(0)
提交回复
热议问题