TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 06-14-2005, 11:03 PM   #1 (permalink)
The Wanderer
 
Join Date: May 2005
Location: Maine|USA
Posts: 17
Thanks: 0
Ogden2k is on a distinguished road
Default Searching

Is creating a search script difficult? I would want to use MySQL fulltext search if possible.

Would I have to create a table of keywords ?

I have 1 DB, and 3 tables that have an auto increment ID that is the primary key.
__________________
TechieHQ
Send a message via AIM to Ogden2k
Ogden2k is offline  
Reply With Quote
Old 06-14-2005, 11:19 PM   #2 (permalink)
The Acquainted
 
Join Date: Mar 2005
Posts: 177
Thanks: 0
CreativeLogic is on a distinguished road
Default

Would you be searching all columns or would you be searching just one column.

What version MySQL do you have too?
CreativeLogic is offline  
Reply With Quote
Old 06-14-2005, 11:21 PM   #3 (permalink)
The Wanderer
 
Join Date: May 2005
Location: Maine|USA
Posts: 17
Thanks: 0
Ogden2k is on a distinguished road
Default

I would probably search just the title. I have the latest version of MySQL and PHP.
__________________
TechieHQ
Send a message via AIM to Ogden2k
Ogden2k is offline  
Reply With Quote
Old 06-15-2005, 12:00 AM   #4 (permalink)
The Contributor
 
Join Date: Mar 2005
Posts: 81
Thanks: 0
AlEast is on a distinguished road
Default

fulltext search in version 4.0 is very good. Take a look at the mysql docs and you can take a look at how to use the built in fulltext search provided.
__________________
NEWEDGE Services, Inc. - Developers of ClientExec
AlEast is offline  
Reply With Quote
Old 06-15-2005, 01:24 AM   #5 (permalink)
The Acquainted
 
Join Date: Mar 2005
Posts: 177
Thanks: 0
CreativeLogic is on a distinguished road
Default

Well in that case you would just use MySQL's search function and you're all set as AlEast stated before! :)
CreativeLogic is offline  
Reply With Quote
Old 06-15-2005, 01:47 AM   #6 (permalink)
The Acquainted
 
Join Date: May 2005
Posts: 106
Thanks: 0
jaswinder_rana is on a distinguished road
Default

Here are some links for you, same thing you want
http://www.zend.com/zend/tut/tutorial-ferrara1.php
http://www.phpfreaks.com/tutorials/129/0.php

hope this helps
__________________
---------------------------
Errors = Improved Programming.
Portfolio
Send a message via MSN to jaswinder_rana
jaswinder_rana is offline  
Reply With Quote
Old 06-26-2005, 08:19 PM   #7 (permalink)
The Wanderer
 
Join Date: May 2005
Location: Maine|USA
Posts: 17
Thanks: 0
Ogden2k is on a distinguished road
Default

Ok, I've got the search working, but I do not care about the fulltext scoring being displayed. Here's the code:
PHP Code:
 <?php  if(!$c) {  ?> 
 <form action="index.php?c=1" method="post"> 
  <input type="text" length="50" name="any" />&nbsp;
  <input type="submit" value="Search" /> 
 </form> 
 <? 
 
} else if($c) { 
 
MySQL_connect("localhost"""""); 
 
MySQL_select_db("ogden2k_iedb"); 
  if((!
$all) || ($all == "")) { $all ""; } else { $all "+(".$all.")"; } 
  if((!
$any) || ($any == "")) { $any ""; }   
 
$query 
  SELECT *,
  MATCH(title, keyword) AGAINST ('
$all $any' IN BOOLEAN MODE) AS score  
          FROM movies  
        WHERE MATCH(title, keyword) AGAINST ('
$all $any' IN BOOLEAN MODE)"
 
$artm1 MySQL_query($query); 
 if(!
$artm1) {  
         echo 
MySQL_error()."<br />$query<br />";  
        } 
 echo 
"<strong>Matches:</strong><br />"
        if(
MySQL_num_rows($artm1) > 0) { 
         echo 
"<table>"
         echo 
"<tr><td>Score </td><td>Title </td></tr>"
            while(
$artm2 MySQL_fetch_array($artm1)) { 
           
$val round($artm2['score'], 3); 
           
$val $val*100
           echo 
"<tr><td>$val</td>"
           echo 
"<td>{$artm2['title']}</td>"
         } 
         echo 
"</table>"
  } 
 else {  
 echo 
"<em>No Results were found in this category.</em><br />";  
 } 
 echo 
"<br />";  
 }
 
?>
__________________
TechieHQ
Send a message via AIM to Ogden2k
Ogden2k is offline  
Reply With Quote
Old 06-27-2005, 10:10 PM   #8 (permalink)
The Acquainted
 
Join Date: May 2005
Posts: 106
Thanks: 0
jaswinder_rana is on a distinguished road
Default

I haven't looked at the code, coz security wise its not good. you are using global variables, which are a NO NO. DONT USE GLOBALS.

if you have to access c then you should be doing ($_GET['c']).

if its your server, then TURN OFF the globals, and if its not your, then advise your host to do so.
its BAD.

EVEN php.net suggests not to use if you can.
try this link
http://www.google.com/search?hs=WjL&...hp&btnG=Search
__________________
---------------------------
Errors = Improved Programming.
Portfolio
Send a message via MSN to jaswinder_rana
jaswinder_rana is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 01:58 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design