solution-digest
| From: | xxx | Date: | Mon, 30 Oct 2000 18:29:47 +0000 |
| Subject: | solution-digest | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-4075@lists.php.net to get a copy of this message | ||
Hi,
>From: "Andris Jancevskis" <a.jancevskis@konts.lv>
>Date: Tue, 31 Oct 2000 09:54:31 +0200
>Subject: how to retrieve file list from directory?
>
>Hi,
>
> how to retrieve file list from directory?
>PHP4.02.
since I do not remember php would have such a function, you
have to issue a system command and read the results.
On linux systems, you can use exec ("ls /www/", $dir);
or $fp = popen ("ls /www/", "r") will do the job.
First case, you will have the results in $dir, being an
array, one line one element ($dir[0], $dir[1], etc.). In the
second case, you open a process file pointer and you ca read
from it wirh fgets () conveniently, one line at a time. "r"
means you only will be able to read from it, it would be a
dumb idea to write into it :) After reached eof, you should
close it with pclose().
The first case is lightyears easyer to process, however,
with some experience, popen will be much more use of you
later.
On windows, respectively, use "dir" instead of "ls".
You may have to specify full path to ls since it is an aux
program. This normally should be "/bin/ls" so use "/bin/ls
/www/" for e.g.
However, if you have to access your files many times, I
suggest you storing the list in a database, so you can
select from it easily - even with "where" clauses.
-o-
>From: "Vojtech Dvorak" <vojtech_dvorak@servind.cz>
>Date: Tue, 31 Oct 2000 09:14:27 +0100
>Subject: Re: [PHP-DB] regularly mysql db web update ?
without quoting your whole letter, DO NOT do this. This is a
very nasty and dirty method to use. Sounds one would sell
his monitor and use his matrix printer (anyone remember
matrix printers anyway ? :) for output.
Why don't you simply have one of your server connect to
another running mysql ?
If you manage to make this connection between your servers
via www, you can find yourself on a very, very, very bad
monday morning (ever heard of hackers ?)
- o -
>Date: 31 Oct 2000 11:23:12 -0000
>From: Matthew Brealey <webmaster@richinstyle.com>
>Subject: Search engine
>
>Hello.
>
>I'm doing a search engine for a dating site. We have
various data about
>the site's users (stored in a MySQL database), which we
then use for
>matching them.
I think mathcing sex, sexuality, age should not be any
problem.
For interests, here's a quick and simply idea: give your
users have 5+5 fields for their interests, 5 for what they
like and 5 what they do not. Instruct them to enter only
simple words, so "cat" or "cats" or "car" or "tennis" and
then you can search with keywords easily. You can even make
statistics for your user's interests, for e.g.When searching
for a string, search for the string itself among users'
interest, and, if string does not end with an "s", then
search for the $string."s" also. This is NOT literally
correct at all but will work fine.
Best regards, Trap