What does a colon before a literal in an SQL statement mean?

后端 未结 3 694
情话喂你
情话喂你 2020-12-19 07:14

What does it mean to use \":\" before a variable ?

For example, :userId in this code:

public function removeUser($userI         


        
3条回答
  •  我在风中等你
    2020-12-19 07:39

    The colon is a common character that indicates a placeholder for a variable value in a SQL statement. In this case, the those placeholders are getting replaced by the value of userId and project_id at runtime. This is great for avoiding SQL injection vulnerabilities.

提交回复
热议问题