Answer the question
In order to leave comments, you need to log in
What is the best way to modify a js file through php?
Let's say we have a file (our database) in which data is stored in this format:
products = [
{
name: "test1",
price: 240,
id: '15',
img: 'http://cs624326.vk.me/v624326831/29f16/hW5YEUNgNvk.jpg',
miniAbout: "бла бла бла бла бла бла бла бла бла ",
about: "Полное тестовове описание этого товара, этот товар очень классный соетуем его купить, не пожелееете! Ах да, забыли сказать, Бла бла бла бла бла бла бла бла бла бла бла бла бла бла бла бла бла бла бла бла бла бла бла бла бла бла бла бла бла бла бла бла бла ",
category: "Электроника"
},
{
name: "test2",
price: 250,
id: '14',
img: 'http://cs627419.vk.me/v627419421/1d545/lODqeVtNlyc.jpg',
miniAbout: "бла бла бла бла бла бла бла бла бла ",
category: "Игры"
},
{
name: "Call Of Duty",
price: 260,
id: '13',
img: 'http://cs7002.vk.me/v7002154/18cec/BOasKNcqf_k.jpg',
miniAbout: "бла бла бла бла бла бла бла бла бла ",
category: "Одежда"
}
]
Answer the question
In order to leave comments, you need to log in
This is json.
It must be parsed and rewritten completely every time, for such a case.
And it's not a database at all, it's not a database at all.
You will have a lot of sex with adding products to your (hehe) "database" ... Think about it and go to the simplest mysql before it's too late.
Yes, you can't call it a database, just an array in json.
Nevertheless ... if the conditions are exactly like this, then you need:
There are no other options.
And if possible, it's better to switch to a real database.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question