php variable insert into database

后端 未结 2 1840
渐次进展
渐次进展 2021-01-19 08:31

I am attempting to insert some php variables into a Mysql database with no luck. The connection works no problem, the variables all have values, so I must be my insert stat

相关标签:
2条回答
  • 2021-01-19 09:07

    If id is an autonumber field, you should not be passing '' in the insert - just drop the field and let your database take care of it. If it's not an autonumber, '' is probably not a valid key value.

    Also, if any of your fields are numeric, not text, they should not have single quotes around them. My guess would be that speed should be a number and should not be in quotes in your query.

    But please, PLEASE, look at the comments on your question -- this is bad code and the comments explain why.

    0 讨论(0)
  • 2021-01-19 09:16

    Try enclosing variable names in { }, i.e.

    '{$speed}'
    
    0 讨论(0)
提交回复
热议问题