M
M
Mikha Pankratov2016-07-15 14:20:07
Yii
Mikha Pankratov, 2016-07-15 14:20:07

What data type to store points in?

Good afternoon,
I'm doing a crop.
I have selection coordinates of 4 of them, what is the best way to store them?
4 fields or points type?
If points, then maybe you can tell me how to handle it easier - to enter data and extract it. Thank you.
Maybe a helper, who saw what?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Timofeev, 2016-07-15
@frmax

Given that you will use them 99% of the time in js, it’s easier to store them in json, for which you have a column of type string (100) in the database,
while in php they can easily be turned into an array and back into json using
json_encode() and json_decode

P
Pogran, 2016-07-15
@Pogran

For me, make a normal string field in the database table. Combine coordinates via implode php.net/manual/ru/function.implode.php and extract via explode php.net/manual/ru/function.explode.php . Or do you not need to enter in the database?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question