Using a variable in the WHERE Clause

后端 未结 3 512
深忆病人
深忆病人 2021-01-27 01:22

I am a newbie in MySQL and PHP. I have a HTML form where I would like to pass 1 variable from to my PHP code and then run a query on my database for the record that holds that v

3条回答
  •  轮回少年
    2021-01-27 01:39

    I agree its a quote issue, but here is how my code would look.

      $sql = 'SELECT * FROM SiteInfo WHERE Serial = "' . $serial . '"';
    

    or

      $sql = "SELECT * FROM 'SiteInfo; WHERE 'Serial' = \"$serial\"";      
    

提交回复
热议问题