Forum Moderators: open
MySQL Table with ID, Title, Content, Date
Enter new blog.
Add blog to displayed list as link.
Call up specific blog from above list--edit it and save it.
That's all well an good for me as the blogger. What I am stumped on is how best to search the contents of the Content item, when a visitor enters a keyword (or keywords) and return links to *only* those blogs that match the search words.
Any pointers much appreciated.
Thanks,
Clair
Here's the one-line form that feeds the query:
<form action="search-blog.php" method="post">
<p>Search for: <input type="text" name="searchword" size="40" maxsize="100" /></p>
<input type="submit" name="submit" value="Go find!" />
</form>
And here's the query that has a syntax problem:
$query = "SELECT * FROM blog_entries WHERE MATCH
(blog_entry={$_GET['entry']}) AGAINST (searchterm={$_POST['searchword']})";
and here's the Error Msg.:
Check the manual that corresponds to your MySQL server version for the right syntax to use near '=) AGAINST (searchterm=testing)' at line 2. The query was SELECT * FROM blog_entries WHERE MATCH (blog_entry=) AGAINST (searchterm=testing).
Note: "testing" was a word I entered into the form.
I know this query is not what I finally want, but it would be useful at some point, it I could get this working.
Thanks much. I've pored over this character by character until I'm blue in the face! lol
Clair
Just came back to tell you that I had everything working with FULLTEXT --
and found just's comment. Thanks!
I found the FULLTEXT help via Zend Developer and the got the query string sorted out with the help of phpfreaks.
Not bad -- whole thing working inside 1 hour (had lunch in the middle!)
Man, I am one happy camper.
Cheers,
Clair