JSON data handling with mySQL and php
<p>For the past 2 days I have been looking over the internet on how to handle data stored as json in mySQL database.All I found was a single article in here which I followed with no luck.So here is my question</p>

<p>This is my table called additional with 2 columns only...jobid and costs. jobid is an int of length 5 and obviously the primary key, costs is simply stored as text. Reason I combined all the costs under one column is because the user in my application can put whatever he/she wants in there, so to me the costs is/are unknown. For example one entry could be </p>

<p>24321 , {"telephone" : "$20"}
      or
24322 , {"telephone" : "$20", "hotel" : "$400"}</p>

<p>and so on and so forth but I hope you get the point.</p>

<p>Now given this example I need to know how to handle data in and out from the database stored as json using php. So insert, select and update but I think with one given example I can do the rest If someone can help me understand how to handle json data in and out from a database. </p>

<p>Oh and one last thing. Not only I need to know how to fetch the data I need to be able to separate it too e.g:</p>

<pre><code>$cost1 = {"telephone" : "$20"};
$cost2 = {"hotel" : "$400"};
</code></pre>

<p>I really hope someone can help with this because like I said above I spent 2 days trying to get my head around this but either no articles on this matter(except the one from this site) or completely irrelevant to my example</p>