html - php update certain fields to database -


I am trying to work on an inventory system where the user sees their inventory and update volume as input by the user Only the rest of the database can be the same. But this is not working, please help me figure out where I was wrong. This success will refresh the message but the database will not be updated.

  & lt; Form name = "form" method = "post" & gt; & Lt; Table width = "70%" range = "5" align = "center" & gt; & Lt; Tr & gt; & Lt; Th scope = "row" & gt; SKU & lt; / Th & gt; & Lt; Th scope = "row" & gt; Item Details & lt; / Th & gt; & Lt; Th scope = "row" & gt; Current legality & lt; / Th & gt; & Lt; Th scope = "row" & gt; Update volume & lt; / Th & gt; & Lt; Th scope = "row" & gt; Unit Price & lt; / Th & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; Th scope = "row" & gt; & Lt ;? Includes php ('connect.php'); $ Result = mysqli_query (select from "Choose From Products") or die (mysqli_error ()); While ($ line = mysqli_fetch_array ($ result)) {resonant "<<" Echo '& lt; Td> & Lt; A name = "sku []" & gt; ' $ Line ['sku_id']. '& Lt; / A & gt; & Lt; / Td> '; Echo '& lt; Td> $ Line ['description']. '& Lt; / Td> '; Echo '& lt; Td> $ Line ['quantity']. '& Lt; / Td> '; Echo & lt; Td> & Lt; Input name = "qty []" /> & Lt; / Td> '; Echo '& lt; Td> $ Line ['unit_pres'] '& Lt; / Td> '; Echo "& lt; / tr & gt;"; }? & Gt; & Lt; / Table & gt; & Lt; Input style = "float: correct" name = "update" type = "submit" id = "update" value = "update" /> & Lt; / Form & gt; & Lt ;? Php if (isset ($ _ POST ['update'])) {$ qty = $ _POST ['qty']; $ Sku = $ _POST ['skew']; Forex Currency ($ value as $ Key = & gt; $ value) {if (empty ($ value)) {continue; } And {$ sql = "update product SET quantity = '". $ Value "'WHUER sku_id ='". $ Sku [$ key] "'"; Mysql_query ($ sql); }} $ Retval = mysqli_query ($ sql); If (! $ Retval) {dead ('Could not update data:' mysql_error ()); } 'Update the data successfully' echo! '; }? & Gt;  

This should be a complete answer (with mysqli update) for you:

  & lt; Form name = "form" method = "post" & gt; & Lt; Table width = "70%" range = "5" align = "center" & gt; & Lt; TR & gt; & Lt; Th scope = "row" & gt; SKU & lt; / Th & gt; & Lt; Th scope = "row" & gt; Item Details & lt; / Th & gt; & Lt; Th scope = "row" & gt; Quantity & lt; / Th & gt; & Lt; Th scope = "row" & gt; Unit Price & lt; / Th & gt; & Lt; / TR & gt; & Lt ;? Includes php ('connect.php'); $ Result = mysqli_query (select from "Choose From Products") or die (mysqli_error ()); While ($ line = mysqli_fetch_array ($ result)) {resonant "<<" Echo '& lt; Td> Htmlspecialchars ($ line ['sku_id']). '& Lt; / Td> '; Echo '& lt; Td> Htmlspecialchars ($ line ['description']). '& Lt; / Td> '; Anco '& lt; Td> & Lt; Input name = "qty ['.htmlspecialchars ($ line [' sku_id ']).']" Value = "'.htmlspecialchars ($ line [' quantity '])." / "Gt;;  gt; 'echo'  & lt; input name =" value [' Htmlspecialchars ($ line ['sku_id']). '' Value = "'. Htmlspecialchars ($ line [' unit_pris '])." / "Gt;; '; echo '' & lt; Input style = "float: right" name = "update" type = "submit" id = "update" value = "/> & quot;;}? & Gt; & lt; / table & gt; Update "/> 
Php if (isset ($ _ POST ['update'])) {$ qty = $ _POST ['qty']; $ value = $ _POST ['Value']; $ stmt = $ mysqli-> stmt_init (); // <- to $ stmt-> this mysqli class method is ready ("update product SET volume = ?, unit_price =? WHERE sku_id =? "); Forex currency ($ quantity = $ gt; $ value as the $ key) {$ data = array ($ qty [$ key], $ value [$ k], $ key); $ Stmt- & gt; Execute ($ sql, $ data);} 'Data Dyatan successfully 'echo!'?}?

The post processing for testing purposes can be changed in the following:

  (Isset ($ _ POST ['update'])) {$ qty = $ _POST ['quantity']; $ value = $ _POST ['value']; // $ stmt = $ mysqli- & gt; stmt_init () ; // <- mysqli class // Method of doing this // $ stmt-> ("Update product SET volume = ?, unit_price =? WHERE sku_id =? "); Foreign currency ($ quantity = $ gt; $ value as $ key) {resonant" updated products SET quantity = ". $ Qty [$ key].", Unit_price = ". $ Value [ $ Key]. "WHERE sku_id =" $ key "& lt; Br / & gt; Execute $ $ data = array ($ volume [$ key], $ value [$ key], $ key); // $ stmt- & gt; ($ sql, $ data);} 'data Update successfully 'echo!';}  

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -