Wednesday, 15 August 2012

how to include php variable in mysqli statement -


My question is how to include the $ value in the MySQL statement, for example

 < Code> $ value = "1" $ sql = "Enter the table (value 1) value ('value_');  

I want to add $ value after Value_. Is it possible? If possible, can you show me that please? Thanks a lot ...

< P> Sure, you wrap the variable name with curly braces:

  $ sql = "table (value 1) values Insert ('value_ {$ value}');  

But at this level of learning you should learn and should be used for PDO statement to avoid the risk of mysql injection.


No comments:

Post a Comment