W
W
WiNNeR_tig2017-01-19 20:49:09
PHP
WiNNeR_tig, 2017-01-19 20:49:09

PHP array working properly and writing it to MySQL?

What would be the correct implementation of writing an array of type 36525,52424,53465,34524 to the database and reading it from there?
Will it be correct through serialize and a text field or are there better ways?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
pankif, 2017-01-19
@pankif

Better translate to JSON.

$array = [1,2,3];
$arrayString = json_encode($aray);

R
Rsa97, 2017-01-19
@Rsa97

See what it's for. If this is a set of data that is only stored in the database and there is no search for it, then store it as you like. If, for example, these are row identifiers of another table and they are needed in JOINs and WHEREs, then they must be stored in separate rows of the associated table.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question