Get the App
SLTechnology News&Howtos  ›  Database  › 

The problem of reference variables in PHP strings

Shulou Source: shulou.com Published: 2022-06-01 07:24:30 10月24日 Update

String reference variables in php are mainly different database operation strings.

1, normal string reference variable

a. The outer layer must quote double quotation marks

b. Variables in a string can be written as: $s or {$s}

two。 Database operation string (database operation instruction)

a. Double quotes must be used in the outer layer of a string

b. Variables must use curly braces {} (except when assigning string attributes), such as:

`c. When a variable is required to be assigned to a database property or to perform a logical operation, the type of the corresponding data attribute is required, such as

The attribute title,authordid,content in the database in the above code is a string, so the variable should be in single quotation marks'{$title}'or'$title',.

Tags: Character string variable data database attribute quotation mark outer layer a.recoery b. different normal code suggestion parenthesis instruction type logic c. operation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei NVidia Microsoft Shulou Tech Info Redmi