Despite looking at a number of tutorials in books and online examples on
pattern matching - I can't quite get my head around it to work... so need
some help.
What I have now is a variable that is POST'ed to a PHP script and I want
the script to go through a database to search through to check if a certain
value is entered in a field, if yes - echo the entire row, if not, move
onto the next record to check.
So far I have managed to write a script that would search each record in
turn of the database - but need something to perform a pattern match. I
have seen a function called preg_grep() but there are no really good
examples, especially on how to construct a pattern search term in the
first place.
Back to the problem, the POST to the PHP script would have a value of say
"video", but the database could have values for that field of "video021" or
"audio005" or "screensaver010" etc.. (file type and file number).
So I need to match the first part of the file ID (and exclude the file
number, ie. "video" and not "video021")... then echo the row each time the
script found a match for "video" and move onto the next row for other
instances of "video" to echo.
Any help appreciated.
Dariusz