A
A
Angry Negro2017-06-17 20:25:06
PHP
Angry Negro, 2017-06-17 20:25:06

How to make a php method - display text from a txt file?

I really need help. Himself - confused. I know there is such an opportunity, but I forgot how to implement it.
The question is the following:
I have a TXT file, it contains lines with information.
by type: photo URL, photo URL, Country, City, Region
,
Price I don't understand how this can be implemented..
Can this be done without MySQL?
And if only through MySQL - then how can this be done? Perhaps someone knows at least a lesson on the Internet on this topic, an article, whatever :)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Saboteur, 2017-06-17
@saboteur_kiev

1. Read the php file line by line, parse the line into a separate url, city, and so on.
Check your filter - if it matches - output the line.
2. Read the php file line by line, parse the line into a separate url, city, and so on.
Add everything to the array.
Then you work with the array - check the filters, output what you need
3. spend 1 hour learning the select command, spend 1 hour learning the insert command, spend 2 hours learning how to work with sqlite from php with viewing examples
Translate your text file into sqlite format, and go

E
Eugene Volf, 2017-06-17
@Wolfnsex

Can this be done without MySQL?
If you have a small amount of data, <200-500Mb in total and don't need some of the features of a "thick" database like MySQL - you can use SQlite3 , its support is built into PHP since version 5.3+ (I think).
How to do this - take any program, for example, SQlite maestro , create a database (file). You add data to the database (database), write an SQL query, something like ... and ... use it. If you specify the question more precisely, you will get a more accurate answer to it :) SELECT * FROM table1 WHERE city = 'Москва';

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question