List Info

Thread: Implementing a Audio/Visual Collection Database with PHP and MySQL




Implementing a Audio/Visual Collection Database with PHP and MySQL
user name
2006-05-07 13:26:34
Hello!
I'm writing a PHP/MySQL solution for a Audio/Video library
for which I
am the librarian. Everything works great, except I feel my
MySQL query
could be improved.  The page of the AV database interface is
located
at: http://www.k
d3qc.com/pflvideosearch.html
The segment of code that I'm having trouble perfecting
follows:

************************************************************
***********
 the code the way I think it should be written

{$sql = "SELECT * FROM videos
where (title REGEXP '[[:blank:]]?\$tempvar[[:blank:]]?')
OR
(subject REGEXP '[[:blank:]]?\$tempvar[[:blank:]]?') OR
(descript_text REGEXP
'[[:blank:]]?\$tempvar[[:blank:]]?')
ORDER BY date DESC ";}

************************************************************
***********

Right now, I'm using the following snippet of code. I use
LIKE. I think
REGEXP would work better. LIKE works ok, except for searches
on a word
like "art" because it returns words that contain
"art" like
"artificial".  I'd like the code to work better
than that.


************************************************************
***********
 the code the way it is currently  written

{$sql = "SELECT * FROM videos
where (title LIKE '%$tempvar%') OR (subject LIKE
'%$tempvar%') OR
(descript_text LIKE '%$tempvar%')
ORDER BY date DESC ";}

************************************************************
**********

Thanks for any help!

Will


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "PHP & MySQL" group.
To post to this group, send email to phpmysqlgooglegroups.com
To unsubscribe from this group, send email to
phpmysql-unsubscribegooglegroups.com
For more options, visit this group at http://groups
.google.com/group/phpmysql
-~----------~----~----~----~------~----~------~--~---

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )