Home  >  Q&A  >  body text

sql语句中 values值为什么要加单引号呢?

sql语句中 values值为什么要加单引号呢?values里面的放的本身就是PHP变量名字呀,双引号中可以解析变量值,为什么还要在变量中加单引号呢

汪汪汪汪2859 days ago1784

reply all(2)I'll reply

  • 数据分析师

    数据分析师2017-09-30 23:14:46

    Why do values ​​in sql statements need to be enclosed in single quotes? -PHP Chinese website Q&A-Why should single quotes be added to the values ​​in the sql statement? -PHP Chinese website Q&A

    Please watch and learn.

    reply
    0
  • 阿神

    阿神2016-12-20 16:53:39

    sql = "insert into user(name, age, class) values('李四', 18, '高三一班')";

    1 双引号中的是一个标准的SQL语句,把他拿到mysql中可以单独执行 

    2 因为是SQL语句,字符型的字段的值要用单引号括起来加以标注

    reply
    0
  • Cancelreply