PHP update table in MySQL not working

前端 未结 2 554
野的像风
野的像风 2021-01-29 08:59

My php won\'t update my products table. I know my GET request worked as I tested it with echo to display the id. I am confused as to how I can get it to work? I think it may be

2条回答
  •  醉话见心
    2021-01-29 09:10

    I think the problems are misusing of ' in one or both of these lines

     . "p_price = '" . $_POST["updateProductPrice"] . "', "
     . "p_stock = " . $_POST["updateProductStock"] . ", "
    

    If the type is string you need to use ' as you used in p_price otherwise if it is float or int you should not use ' as you did for p_stock.

    It seems you used wrong for these two field. Since the p_price would be float and p_stock is string.

     . "p_price = " . $_POST["updateProductPrice"] . ", "
     . "p_stock = '" . $_POST["updateProductStock"] . "' , "
    

提交回复
热议问题