sql server - PHP insert array of values -


I am not able to work my INSERT statement. I know the problem is that I'm working on how to bind the parameters before I joined the compounding parameter.

  $ inventoryQuery = "insert list (Whse, product details, QtyOnHand, QtyUnavail, BinLoc1, BinLoc2, GLCost, OnhandTotalValue, UnavailTotalValue, GrandTotalValue) values ​​(,,,,,,,, ,, '?' '?' '' '?' '?' '?' '?' '?' '?' '?' '?'); "; // INSERT statement executed $ conn = $ global ['conn']; $ Stmt = $ conn- & gt; Ready ($ inventoryQuery); $ Stmt- & gt; Bypass (1, $ sqlV [0]); $ Stmt- & gt; Bindamaram (2, $ sqlv [1]); $ Stmt- & gt; Bendam (3, $ sqlV [2]); $ Stmt- & gt; Bindamaram (4, $ sqlV [3]); $ Stmt- & gt; Bindamaram (5, $ sqlV [4]); $ STMT- & gt; Bindamaram (6, $ sqlV [5]); $ STMT- & gt; Baidam Parm (7, $ sqlV [6]); $ Stmt- & gt; Bind Parm (8, $ sqlV [7]); $ STMT- & gt; Bind Parm (9, $ sqlV [8]); $ STMT- & gt; Beyond Parm (10, $ sqlv [9]); $ Stmt- & gt; Bindamaram (11, $ sqlv [10]); $ Stmt- & gt; Executed ();  

output using var_dump ($ stmt):

object (PDOStatement) [2] Public 'query string' => string into a list (Whse, product details, QtyOnHand, QtyUnavail, BinLoc1, BinLoc2, GLCost, OnhandTotalValue, UnavailTotalValue, GrandTotalValue) values ​​(,,,,,,,,,,); ?????????? (Length = 1 9 2)

I have seen many ways to handle the binding parameters and try. And now my head is floating. If you can provide a solution and a description, I would be very happy

Solution from all the information provided.

  Try {$ Conn -> Set Attribution (PDO :: ATTRRAMOD, PDO :: ERRMODXEpision); $ InventoryQuery = "Entering list ($ sqlField) values ​​(,,,,,,,,,,,, ??????????)"; // INSERT statement executed $ conn = $ global ['conn']; $ Stmt = $ conn- & gt; Ready ($ inventoryQuery); $ Stmt- & gt; Bind Value (1, $ sqlV [0]); $ Stmt- & gt; Bind value (2, $ sqlV [1]); $ Stmt- & gt; Bind value (3, $ sqlV [2]); $ Stmt- & gt; Bind value (4, ((int ($ float) $ sqlV [3]))); $ Stmt- & gt; Bind value (5, ((int ($ float) $ sqlV [4]))); $ Stmt- & gt; Bind Value (6, $ sqlV [5]); $ STMT- & gt; Byte value (7, $ sqlV [6]); $ Stmt- & gt; Bind value (8, (float) $ sqlV [7])); $ Stmt- & gt; Tie Value (9, (float) $ sqlV [8])); $ Stmt- & gt; Bind value (10, (float) $ sqlV [9])); $ STMT- & gt; Bind value (11, (float) $ sqlV [10])); $ Stmt- & gt; Executed (); } Hold (PDOException $ east) {var_dump ($ east); }  

Thanks for everyone!

I try my performance to go along with the type wrong column in a catch block And make sure that SQL is not throwing any errors. If so, it's likely that you will do what you

Here is an example:

  try {$ stmt- & gt; carry about (); } Hold (PDOException $ ex) {// Log this object or just error message logs ($ ex-> getMessage ()); // suppose you have some type of global logger}  

PS You can remove the semi-colon in your query string. Nothing should hurt if it is in the end, but if you want to add anything after this, then it will end your statement.


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? -