php - Inserting $_POST array into databse -


Columns in my database: stat_id, stat1, stat2, stat3

I am using a form, I am allowed to loop through the list of members and they have 3 different data each ($ Member_stat is already an array in which 'stat_id' has its own key Is included as a)

  foreach ($ member_stats as member_stat) {echo ' '; = "Stat2" & gt; For 'echo' & lt; label state 2 & lt; / Label & gt; '; Echo '& lt; Input type = "text" name = "'. $ Member_stat [' stat_id '].' Stat2" id = "stat2" />; '; = 'Stat3' & gt; For 'echo' & lt; label state 3 & lt; / Label & gt; '; Echo '& lt; Input type = "text" name = "'. $ Member_stat [' stat_id '].' Stat3 'id =" stat3 "/> 

I hit the submit and my $ _POST array / data looks like this:

  Array ([157stat1] = 1 [157stat2] = 4 [157stat 3] = 7 [158stat1] = 2 [158stat2] = 2 [158stat3] = 6 [15 9 state1] = 8 [15 9 state 2] = 6 etc ... My question is: how do I get this $ _POST array and it's in the form of the above In my database? Ie.  
  157 stat1 stat2 stat3 158 stat1 stat2 stat3 159 stat1 stat2 etc ...   

I have tried many things , It's wrapping up a difficult time in my head around i.e. stat_id separating data from $ _POST keys (ie: stat1, stat2, stat3 from 157). I'm thinking if I set it to wrong Any other information should be appreciated very much. Thanks.

$ out = array (); $ Post = array ('157stat1' => 1, '157stat2' => 2, '157stat3' => 3, '158stat1' => 1); Forex Currency ($ post $ key = & gt; $ value) {if (preg_match ('/ ^ (\ d +) (\ w +) $ /', $ key, $ match) == 0 $ $ [$ Match [1]] [] = $ match [2]; } Var_dump ($ out);

Prepare the $ out and SQL statement through that code. ($ $ = $ out $ $ as $ $) {// escape array $ value (array for each $ key ('stat1', 'stat2', ' Stat3, ...)) and string $ keys (this will be 157, 158 and so on) / / SQL statement / preparation and joining / joining function will help in dealing with array values ​​$}

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -