更新存储在DB

时间:2015-10-09 13:45:49

标签: php mysql json

我有一个DB表,他的一个列包含一个像这样的JSON字符串:

{"freet1":"\u05d2'\u05dc\u05d0\u05e8\u05d8\u05d4 \u05de\u05d5\u05d3\u05d9\u05e2\u05d9\u05df - \u05de\u05d5\u05d3\u05d9\u05e2\u05d9\u05df - \u05ea\u05e4\u05e8\u05d9\u05d8 \u05de\u05e9\u05dc\u05d5\u05d7\u05d9\u05dd - Ice Cream | Tinder","freet2":"5% \u05d4\u05e0\u05d7\u05d4","freet3":"\u05dc\u05de\u05d6\u05de\u05d9\u05e0\u05d9\u05dd \u05d3\u05e8\u05da \u05d4\u05d0\u05ea\u05e8","freet6":"\u05d4\u05d4\u05d6\u05de\u05e0\u05d4 \u05e9\u05dc\u05d9","freet4":"\u05d0\u05d9\u05df \u05d0\u05e4\u05e9\u05e8\u05d5\u05ea \u05dc\u05e9\u05e2\u05e8\u05da \u05d0\u05ea \u05d4\u05d4\u05d6\u05de\u05e0\u05d4 \u05de\u05db\u05d9\u05d5\u05d5\u05df \u05e9\u05d4\u05de\u05d5\u05e6\u05e8\u05d9\u05dd \u05e9\u05e7\u05d9\u05dc\u05d9\u05dd. \u05de\u05d9\u05e0\u05d9\u05de\u05d5\u05dd \u05de\u05e9\u05dc\u05d5\u05d7 45 \u05e9\"\u05d7","0":{"menu":"\u05d2\u05dc\u05d9\u05d3\u05d5\u05ea \u05e9\u05de\u05e0\u05ea","currentmenufile":"142525634133.JPG","data":[{"product":"\u05e9\u05d5\u05e7\u05d5\u05dc\u05d3 \u05de\u05e0\u05d8\u05d4","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425056679\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425056679\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05e9\u05d5\u05e7\u05d5\u05dc\u05d3 \u05d1\u05dc\u05d2\u05d9","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425056687\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425056687\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05e9\u05d5\u05e7\u05d5\u05dc\u05d3 \u05dc\u05d1\u05df","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425056695\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425056695\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05e9\u05d5\u05e7\u05d5\u05dc\u05d3 \u05e7\u05d9\u05e0\u05d3\u05e8","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425056702\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425056702\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05e9\u05d5\u05e7\u05d5\u05dc\u05d3 \u05ea\u05e4\u05d5\u05d6","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425056727\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425056727\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05e8\u05d9\u05d1\u05ea \u05d7\u05dc\u05d1","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425056815\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425056815\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05dc\u05d5\u05d8\u05d5\u05e1","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425056823\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425056823\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05e7\u05e4\u05d5\u05e6'\u05d9\u05e0\u05d5","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425056830\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425056830\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05d5\u05d9\u05e1\u05e7\u05d9","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425056944\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425056944\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05d5\u05e0\u05d9\u05dc \u05e6\u05e8\u05e4\u05ea\u05d9","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425056953\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425056953\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05e2\u05d5\u05d2\u05d9\u05d5\u05ea \u05d0\u05d5\u05e8\u05d0\u05d5","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425056962\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425056962\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05de\u05e7\u05d5\u05e4\u05dc\u05ea","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425057129\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425057129\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05d5\u05e0\u05d9\u05dc \u05e7\u05dc\u05d9\u05e7","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425057136\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425057136\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05e4\u05e0\u05d9\u05e0\u05ea \u05d9\u05e2\u05e8","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425057143\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425057143\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05d8\u05d5\u05d5\u05d9\u05e7\u05e1","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425057472\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425057472\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05e2\u05d5\u05d2\u05ea \u05d2\u05d1\u05d9\u05e0\u05d4","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425057480\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425057480\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05ea\u05d5\u05ea \u05d1\u05e9\u05de\u05e0\u05ea","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425057487\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425057487\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05e4\u05e8\u05e8\u05d5 \u05e8\u05d5\u05e9\u05d4","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425058752\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425058752\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05e7\u05e8\u05de\u05dc \u05de\u05dc\u05d5\u05d7","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425058759\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425058759\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05d8\u05d5\u05e4\u05d9\u05e4\u05d9","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425058768\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425058768\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05d1\u05d0\u05d5\u05e0\u05d8\u05d9","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425060944\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425060944\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05e4\u05d9\u05e1\u05d8\u05d5\u05e7","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425060952\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425060952\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05d5\u05e4\u05dc \u05de\u05d9\u05d9\u05e4\u05dc","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425060960\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425060960\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05e0\u05d5\u05d8\u05dc\u05d4","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425063548\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425063548\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05dc\u05d5\u05d0\u05e7\u05e8","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425063559\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425063559\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05d7\u05dc\u05d1\u05d4","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425063567\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425063567\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05e7\u05e8\u05dd \u05e9\u05e0\u05d9\u05d8","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425256001\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425256001\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05d1\u05e0\u05e0\u05d4 \u05e4\u05e7\u05d0\u05df","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425410592\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425410592\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05e1\u05e0\u05d9\u05e7\u05e8\u05e1","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425256019\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425256019\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05d0\u05dc\u05e4\u05d7\u05d5\u05e8\u05e1","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425410136\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425410136\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05d8\u05d9\u05e8\u05de\u05d9\u05e1\u05d5","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425410144\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425410144\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05de\u05d2\u05e0\u05d5\u05dd","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425410156\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425410156\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05e8\u05e4\u05d0\u05dc\u05d5","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425410168\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425410168\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05d8\u05e2\u05de\u05d9","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425410185\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425410185\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05de\u05d9\u05dc\u05e7\u05d9","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425410193\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425410193\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05d9\u05d5\u05d2\u05d5\u05e8\u05d8 \u05d5\u05e4\u05d9\u05e8\u05d5\u05ea \u05d9\u05e2\u05e8","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425410202\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425410202\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"}],"menufile":"142525634133.JPG"},"1":{"menu":"\u05d2\u05dc\u05d9\u05d3\u05d5\u05ea \u05e1\u05d5\u05e8\u05d1\u05d4","currentmenufile":"142532108933.JPG","data":[{"product":"\u05dc\u05d9\u05de\u05d5\u05df","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425410247\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425410247\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05dc\u05d9\u05de\u05d5\u05e0\u05e2\u05e0\u05e2","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425410247\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425410247\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05ea\u05d5\u05ea \u05e9\u05d3\u05d4","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425410255\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425410255\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05e4\u05e1\u05d9\u05e4\u05dc\u05d5\u05e8\u05d4","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425410270\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425410270\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05de\u05e0\u05d2\u05d5","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425410270\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425410270\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05ea\u05e4\u05d5\u05d7 \u05d9\u05e8\u05d5\u05e7","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425410270\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425410270\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05e4\u05d9\u05e8\u05d5\u05ea \u05d9\u05e2\u05e8","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425410278\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425410278\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05e9\u05d5\u05e7\u05d5\u05dc\u05d3 \u05de\u05e8\u05d9\u05e8","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425410284\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425410284\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05e7\u05d5\u05e7\u05d5\u05e1","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425410290\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425410290\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05d3\u05d9\u05d0\u05d8 \u05e4\u05d9\u05e8\u05d5\u05ea","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"u","pnew":"u","psale":"u","pactive":"y","currentfile":"1425410297\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425410297\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"}],"menufile":"142532108933.JPG"},"2":{"menu":"\u05d2\u05dc\u05d9\u05d3\u05d5\u05ea \u05e1\u05d5\u05d9\u05d4","currentmenufile":"142532142833.JPG","data":[{"product":"\u05d1\u05d5\u05d8\u05e0\u05d9\u05dd","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425410304\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425410304\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05d7\u05dc\u05d1\u05d4","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425410310\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425410310\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05e4\u05d9\u05e1\u05d8\u05d5\u05e7","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425410321\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425410321\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05dc\u05d5\u05d8\u05d5\u05e1","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425410316\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425410316\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05d0\u05d2\u05d5\u05d6\u05d9 \u05dc\u05d5\u05d6","desc":"","price":"84","pgraysmall":"\u05dc\u05e7"\u05d2","pgreen":"","unit":"k","pnew":"u","psale":"u","pactive":"y","currentfile":"1425410327\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425410327\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"}],"menufile":"142532142833.JPG"},"3":{"menu":"\u05e7\u05d9\u05e0\u05d5\u05d7\u05d9\u05dd","currentmenufile":"142564673833.JPG","data":[{"product":"\u05e7\u05e8\u05e4 \u05e6\u05e8\u05e4\u05ea\u05d9","desc":"","price":"18","pgraysmall":"\u05dc\u05d9\u05d7'","pgreen":"","unit":"u","pnew":"u","psale":"u","pactive":"y","currentfile":"1425646773\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425646773\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05e7\u05e8\u05e4 + \u05d2\u05dc\u05d9\u05d3\u05d4 + \u05e7\u05e6\u05e4\u05ea","desc":"","price":"30","pgraysmall":"\u05dc\u05d9\u05d7'","pgreen":"","unit":"u","pnew":"u","psale":"u","pactive":"y","currentfile":"1425646783\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425646783\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05d5\u05d5\u05e4\u05dc \u05d1\u05dc\u05d2\u05d9","desc":"+ 2 \u05db\u05d3\u05d5\u05e8\u05d9\u05dd + \u05e7\u05e6\u05e4\u05ea \u05d5\u05e1\u05d9\u05e8\u05d5\u05e3","price":"49","pgraysmall":"\u05dc\u05d9\u05d7'","pgreen":"","unit":"u","pnew":"u","psale":"u","pactive":"y","currentfile":"1425646790\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425646790\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"},{"product":"\u05e1\u05d5\u05e4\u05dc\u05d4 \u05e9\u05d5\u05e7\u05d5\u05dc\u05d3 \u05d7\u05dd","desc":"+ \u05db\u05d3\u05d5\u05e8 \u05d2\u05dc\u05d9\u05d3\u05d4 + \u05e7\u05e6\u05e4\u05ea \u05d5\u05e1\u05d9\u05e8\u05d5\u05e3","price":"38","pgraysmall":"\u05dc\u05d9\u05d7'","pgreen":"","unit":"u","pnew":"u","psale":"u","pactive":"y","currentfile":"1425796952\u05ea\u05e4\u05e8\u05d9\u05d8.JPG","file":"1425796952\u05ea\u05e4\u05e8\u05d9\u05d8.JPG"}],"menufile":"142564673833.JPG"}}

是否可以仅更新1"产品"通过这种方式?因为如果我有超过1,000种产品,则更新非常慢(更新所有字符串)

然后通过SQL获取字符串更好的方法选择解码,更改特定值然后更新完整的字符串?

谢谢!

2 个答案:

答案 0 :(得分:0)

要更新存储在MySQL中的JSON字符串的一部分,您确实需要检索,解码到数组/对象,编辑,编码为JSON并存储。这很费时间。

我建议您更改表架构。现在还不确定它是如何设置的,但是您可以只为Products创建一个表,为Orders创建另一个表,为{{1}设置另一个表,而不是让一个表包含所有信息。 1}}等等。

因此,在您的Customers表中,每个产品只有一行:

Products

然后在另一个表中,当您需要引用此产品时,您只需使用ID | NAME | DESCRIPTION | PRICE 00123| jacket | gray wool jacket | $4.99 值。您可以更轻松地更新产品的表行,而不是编辑其JSON。

答案 1 :(得分:-1)

关于您的第一个问题,您不能只更新一个产品。每个产品应该有一行,听起来像一个糟糕的数据库设计。如果它是一个静态页面可能会有所帮助,但如果你想更新或删除产品,它将会非常昂贵。

编辑:很明显,当我说'#34;你不能只更新一个产品"我的意思是说你必须解码JSON字符串,修改生成的数组并再次对其进行编码以更新单个产品"。说“#34;你不能只更新一个产品而不必更新整个JSON数组"更为正确。