I try to write the similarity of an online store in php (at the same time I teach), it is convenient to store data in CSV , about a thousand products, say such a format:
Артикул;Радиус;Фото;Вылет;Болты;Фирма;Гарантия;Склад;Цвет;Цена 1;16;1.jpeg;6;4;Yokohama;6;4;1;2999 2;16;2.jpeg;4;4;Yokohama;4;4;1;3999 3;17;3.jpeg;33;4;Bridgestone;33;4;1;4999 4;17;4.jpeg;34;5;Goddyyear;34;5;1;5250 5;15;5.jpeg;45;4;Medved;45;5;1;4456
I read from the file like this:
$f = fopen("file.csv", "rt") or exit("Ошибка загрузки базы данных!"); $header=fgetcsv($f,1000,";");
and further cycle. Tell me your opinion:
- Is it correct? It looks good, does not slow down.
- if it is more rational to use SQL, why? or no difference?
- Wouldn't such a method be loading the server much? or will SQL be easier?
Join-ax, процедурах,триггерах,функциях...
And if you have millions of tables, how will you handle? Learn SQL, without it anywhere. - VfvtnjdА если у вас миллионы таблицы
, a good answer to the question about small projects. Files may be quite acceptable option. - alexlz