How to escape sql injection from HANA placeholder

后端 未结 1 1436
失恋的感觉
失恋的感觉 2021-01-25 01:41

I have some HANA queries which use PLACEHOLDER input and of course I want to prevent an sql injection.

I try to use ? in odbc_prepare()

1条回答
  •  悲&欢浪女
    2021-01-25 02:04

    The (old) placeholder syntax ('PLACEHOLDER'=('', '')) you're using here does not allow for bind variables.

    Instead, the new placeholder syntax (PLACEHOLDER.""=>?) allows using bind variables.

    In your code this would look like this:

    $query = << ?)
    WHERE col = ?
    SQL;
    $stmt = \odbc_prepare($conn, $query);
    

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