Jump to content


php mysql fulltext search index help plz -> I am a newbie for php and mysql

  • Please log in to reply
No replies to this topic

#1 underwinefx

  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 15 September 2006 - 10:09 AM

I tried to implement the "similar article" tutorials available in internet using "FULLTEXT" search index. The database -"quotation" contains a table "quotation_list" with two fields -> "quotation_id" and another text field "quote" with quotations (or any text data).

The precise method said in the tutorial is as follows;
1. use some method to separate the data stored in text field using <space> as separator to get each word of the quotation separately.
2. Now, each 'data'(word) retrieved by the explode function is compared using "MATCH" function with the text data field "QUOTE"
3. Now, the matching "quotation_id" (numeric PRIMARY KEY field of the table) are listed as a list side by side for eg; as follows:
RELATED QUOTE NO: 1, 4, 5, 6, 7

I am able to display the entire list of data in a single page:

Code begins
//Database details to connect to mysql server

//Mysql Database Connection
@mysql_select_db($database) or die( "Unable to select database");

//Mysql Query to retrieve quotation id and the quotation from quotation table
$result=mysql_query("SELECT * FROM quotation");

//Getting the number of rows of result from the query to be used in the loop to display results...

//Title of the page
echo "<b><center>List Of Quotation</center></b><br><br>";

//Loop to get the data

while ($i < $num) {


//Data output on page one below the other
echo "Quote No:<b>$quotation_id</b><br>Quote: $quotation_text<br><hr><br>";
//end of code

But I have difficulty in using the php mysql coding to retrieve the related data and displaying it. I want the related quotation numbers displayed below every quote automatically.

Since I am new to the forum and do NOT know if displaying the external link of the tutorial that I read to try to add the related quote function to this code, I am NOT adding the link here.

Now, actually I would be happy to have a single quote output per page with a list of all related text data...I mean, the quotation id and quotation in a single page instead of having the entire quotation list in the same page.

The rough idea is as follows:

Page 1:
<previous page link><next page link>
Quote No: <quotation_id>
Quote 1: <quote text>
Related Quotes:
related quote id 1
related quote 1

related quote id 2
related quote 2

<previous page> <next page>

Can someone help me with this? Pagination is NOT a necessity and I would be perfectly content with even a simple script since I am going to use it only locally on my system for my personal use.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users