php - Put a list in mysql and receive in c# -
it's stupid question got following problem. in table got column called itemids. now, when person has instance 2 items, want add these 6-digit ids same field can receive them @ same time when call column itemids specific user in c# api. question is, best/easiest way this? read serialize array in php don't think work in combination c#
it's bad practice put multiple values in 1 field. should use 1 many relation. being said, done json. use json_encode on php side , json deserializer on c# side.
php
$array = [123456,654321] // , more dummy data $json = json_encode($array); // insert $json database here c#
// data here , store in var (e.g. jsondata) javascriptserializer ser = new javascriptserializer(); var ids = ser.deserialize<list<int>>(jsondata);
Comments
Post a Comment