Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP json_encode and insert data to database
    text
    copied!<p>I use codeigniter.how can insert this values(in the html code) to a row of database by <code>json_encode</code>?</p> <p><strong>Demo:</strong> <a href="http://jsfiddle.net/AQPwv/3/" rel="nofollow">http://jsfiddle.net/AQPwv/3/</a></p> <pre><code>&lt;input name="name_r[0][]" value="hi"&gt; &lt;p&gt; &lt;input name="units[1][]" value="how"&gt; &lt;input type="text" name="units[1][]" value="2" style="width:20px;"&gt; &lt;input type="text" name="units[1][]" value="256314" style="width:65px;"&gt; &lt;input name="units[1][]" value="fine"&gt; &lt;input type="text" name="units[1][]" value="4" style="width:20px;"&gt; &lt;input type="text" name="units[1][]" value="854621" style="width:65px;"&gt; &lt;p&gt; &lt;input type="text" name="price_change[2][]" value="21466" style="width:75px;"&gt; &lt;input type="text" name="price_change[2][]" value="54219" style="width:75px;"&gt; &lt;input type="text" name="price_change[2][]" value="48752" style="width:65px;"&gt; &lt;input type="text" name="price_change[2][]" value="86541" style="width:75px;"&gt; &lt;input type="text" name="price_change[2][]" value="47276" style="width:75px;"&gt; &lt;input type="text" name="price_change[2][]" value="74538" style="width:65px;"&gt; &lt;p&gt; &lt;hr&gt; &lt;p&gt; &lt;input name="name_r[0][]" value="hello"&gt; &lt;p&gt; &lt;input name="units[1][]" value="Library"&gt; &lt;input type="text" name="units[1][]" value="5" style="width:20px;"&gt; &lt;input type="text" name="units[1][]" value="95641" style="width:65px;"&gt; &lt;input name="units[1][]" value="khobee"&gt; &lt;input type="text" name="units[1][]" value="6" style="width:20px;"&gt; &lt;input type="text" name="units[1][]" value="84527" style="width:65px;"&gt; &lt;input name="units[1][]" value="PowerTools "&gt; &lt;input type="text" name="units[1][]" value="7" style="width:20px;"&gt; &lt;input type="text" name="units[1][]" value="75462" style="width:65px;"&gt; &lt;p&gt; &lt;input type="text" name="price_change[2][]" value="8457" style="width:75px;"&gt; &lt;input type="text" name="price_change[2][]" value="134" style="width:75px;"&gt; &lt;input type="text" name="price_change[2][]" value="76144" style="width:65px;"&gt; &lt;input type="text" name="price_change[2][]" value="956414" style="width:75px;"&gt; &lt;input type="text" name="price_change[2][]" value="7546" style="width:75px;"&gt; &lt;input type="text" name="price_change[2][]" value="123" style="width:65px;"&gt; &lt;input type="text" name="price_change[2][]" value="84541" style="width:75px;"&gt; &lt;input type="text" name="price_change[2][]" value="654" style="width:75px;"&gt; &lt;input type="text" name="price_change[2][]" value="8165" style="width:65px;"&gt; &lt;input type="text" name="price_change[2][]" value="2145" style="width:75px;"&gt; &lt;input type="text" name="price_change[2][]" value="354" style="width:75px;"&gt; &lt;input type="text" name="price_change[2][]" value="4774" style="width:65px;"&gt; </code></pre> <p><strong>Update:</strong> I want store data in the database table as:</p> <pre><code>[{ "name_r": "hi", "units": ["how", "2", "256314"],["fine", "4", "854621"], "price_change": ["21466", "54219", "48752"],["86541", "47276", "74538"], }, { "name_r": "hello", "units": ["Library", "5", "95641"],["khobee", "6", "84527"],["PowerTools ", "7", "75462"], "checkbox_units": ["8457", "134", "76144"],["956414", "7546", "123"],["84541", "654", "8165"],["2145", "354", "4774"] }] </code></pre> <p>how is it?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload