Hi everyone,
I have a script that searches a MySQL db and I am having a problem.
First, the problem.... If I search the db through phpMyAdmin, all goes well. If I run rhis script, I may or may not get the results I am after. For example, I have several entries for furniture repair. If I search for furniture repair, I get no results. If I search for furniture, I get no results. If I search for repair, I also get auto repair, TV repair, etc...
I am thinking there is something wrong with the script because as I said earlier, I can search for virtually anything using phpMyAdmin and get the proper results back. So, can anyone suggest any improvements to this script or point me to a resource?
Thanks in advance,
Jim
$query = sprintf (
"SELECT `Cats`.`Name`,`Address`.`Address`,`Address`.`Ci
+ty`,`Contact`.`Phone`,`Keys`.`Keywords`
FROM
(
`Cats`
LEFT JOIN
`Address`
USING (`Name`)
LEFT JOIN
`Contact`
USING (`Name`)
LEFT JOIN
`Keys`
USING (`Name`)
)
WHERE
`Keys`.`Keywords` LIKE '%$search%'
ORDER BY name asc LIMIT %d,%d",
$start - 1, # number of records to skip
$per_page + 1);
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.