Tutorials
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOtherTutorials

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today!
  #1  
Old June 23rd, 2004, 05:54 AM
MrTurkey MrTurkey is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Melbourne, VIC, Australia
Posts: 3 MrTurkey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to MrTurkey
Creating a Search Application

I thought I would pass some comments on this tutorial.

I have found it to be greatly useful in my latest development project. I have been adapting it to my own database handlers using a postgress back end.

I am using it index keywords from web pages stored in my database which were retieved using a web crawler written in PHP.

Great work!

Just having trouble getting the search form to pass the search terms to the search class. For some reason nothing is being passed through at the moment.

This works from the search form:

$search = new Search($_POST['search_term']);
echo "===============<br>";
echo $_POST['search_term'];
echo "<br>===============<br>";

But this ...

$match = "keywords.keyword in ('"
. $search[0] . "'";
$numwords = count ($search);
for ($i = 1; $i < $numwords; $i++) {
$match .= ", '" . $search[$i] . "'";
}
$match .= ")";
$query = "SELECT harvest.url, keywords.keyword, "
. "count(*) as counter "
. "FROM harvest, keywords "
. "WHERE $match "
. "AND keywords.url_id = harvest.urlid "
. "GROUP BY keywords.url_id, keywords.keyword, harvest.url "
. "ORDER BY counter DESC";
echo $query;

Gives:

SELECT harvest.url, keywords.keyword, count(*) as counter FROM harvest, keywords WHERE keywords.keyword in ('') AND keywords.url_id = harvest.urlid GROUP BY keywords.url_id, keywords.keyword, harvest.url ORDER BY counter DESC

Any advice would be most welcome.


Reply With Quote
  #2  
Old June 23rd, 2004, 12:30 PM
Matt Matt is offline
Moderator
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 10 m 20 sec
Reputation Power: 6
RE: Creating a Search Application

How is the $search variable being populated?

Reply With Quote
  #3  
Old June 23rd, 2004, 10:30 PM
MrTurkey MrTurkey is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Melbourne, VIC, Australia
Posts: 3 MrTurkey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to MrTurkey
RE: Creating a Search Application

As per the tutorial, code below for the form:

<form method=POST action="<?= $_SERVER['PHP_SELF'] ?>">
<p><input type="text" name="search_term" size="20">
<input type="submit" name="submit" value="Submit"></p>
</form>

Reply With Quote
  #4  
Old June 23rd, 2004, 10:36 PM
MrTurkey MrTurkey is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Melbourne, VIC, Australia
Posts: 3 MrTurkey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to MrTurkey
RE: Creating a Search Application

I think that bit is working now, new error though:


Your search results:

Warning: Invalid argument supplied for foreach() in search_form.php on line 24

Line 24 from search_form.php is:
foreach($results as $row) {

Preceding code is below:

$results = $search->doSearch();
if($results) {
echo "<p><b>Your search results:</b></p>n";
echo "<p>";
echo count($results);
foreach($results as $row) {



Reply With Quote
Reply

Viewing: Codewalkers ForumsOtherTutorials > Creating a Search Application


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway