Re: [PHP] wildcard search?

2002-11-11 Thread Rasmus Lerdorf
That's because this is a MySQL-specific question and you should be reading the MySQL documentation or asking on the MySQL list. -Rasmus On Mon, 11 Nov 2002, Håkan wrote: I'm trying to make a small and simple search function, but it only works for exact searches, and I can't figure out how to

RE: [PHP] wildcard search?

2002-11-11 Thread John W. Holmes
You'll do it in the database, not PHP. Look into using LIKE in your query... SELECT * FROM yourtable WHERE column LIKE '%searchterm%' The % characters are wildcards that'll match any amount of characters. You can use _ to match a single character. You could also look at FULL-TEXT indexing in

Re: [PHP] wildcard search?

2002-11-11 Thread John Nichel
RTFM... http://www.mysql.com/doc/en/Pattern_matching.html Håkan wrote: I'm trying to make a small and simple search function, but it only works for exact searches, and I can't figure out how to make a wildcard search, if I do it in the php or in the mysql_query, can't really find anything about

Re: [PHP] Wildcard search

2002-11-08 Thread Marco Tabini
How about: $a = explode (' ', shell_exec (ls $foldername/*.html)); This should return an array that contains the name of all the *.html files in the folder $foldername, if any. Hope this helps. Cheers, Marco - php|architect -- The Monthly Magazine For PHP Professionals Come

RE: [PHP] Wildcard search

2002-11-08 Thread Mark Charette
-Original Message- From: Mako Shark [mailto:phpman2000;yahoo.com] do I have to do a readdir() and read the filename of every file until I find an HTML or until all files have been read. This is what the shell expression supplied by Marco Tabini actually does; doing it in PHP

Re: [PHP] Wildcard search

2002-11-08 Thread Mako Shark
$a = explode (' ', shell_exec (ls $foldername/*.html)); Didn't know of shell_exec() until now. It works, though. Thanks! Is there any reason why it wouldn't work? If I changed servers, say, and there were some ports blocked and etc. etc., is there a risk that I should know?

Re: [PHP] Wildcard search

2002-11-08 Thread Marco Tabini
Well, as a general rule, it won't work if you're not using a UNIX o/s or if PHP has been set up with safe mode on, or if you don't have the right permission to see that folder. That's probably a non-inclusive list, but there should be ways around each of these problems (depending on the degree of

Re: [PHP] Wildcard search

2002-11-08 Thread Charles Wiltgen
Mako Shark wrote... Didn't know of shell_exec() until now. It works, though. Thanks! Is there any reason why it wouldn't work? If I changed servers, say, and there were some ports blocked and etc. etc., is there a risk that I should know? My understanding is that many security-conscious

Re: [PHP] Wildcard search

2002-11-08 Thread Mako Shark
Well, as a general rule, it won't work if you're not using a UNIX o/s orif PHP has been set up with safe mode on, or if you don't have the rightpermission to see that folder. That's probably a non-inclusive list, butthere should be ways around each of these problems (depending on thedegree of

Re: [PHP] Wildcard search

2002-11-08 Thread Marco Tabini
If you're only executing one-liners and get all the results back you're better off using shell_exec(). popen() lets you open a pipe to a command--that way, you can funnel data to it as if you were typing from the keyboard. Permissions would be a problem with readdir() as well. Marco --

Re: [PHP] Wildcard search

2002-11-08 Thread Mako Shark
If you're only executing one-liners and get all the results back you're better off using shell_exec(). popen() lets you open a pipe to a command--that way, you can funnel data to it as if you were typing from the keyboard. That's what I'll do then: use shell_exec(). Permissions would be