underwinefx Posted September 15, 2006 Share Posted September 15, 2006 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, 7I am able to display the entire list of data in a single page:[code]<?phpCode begins//Database details to connect to mysql server$username="username";$password="password";$database="quotation";//Mysql Database Connectionmysql_connect('localhost',$username,$password);@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...$num=mysql_num_rows($result);//Title of the pageecho "<b><center>List Of Quotation</center></b><br><br>";//Loop to get the data$i=0;while ($i < $num) {$quotation_id=mysql_result($result,$i,"quotation_id");$quotation_text=mysql_result($result,$i,"quotation_text");//Data output on page one below the otherecho "Quote No:<b>$quotation_id</b><br>Quote: $quotation_text<br><hr><br>";$i++;}//end of code?>[/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:[quote]Page 1:<previous page link><next page link>[hr]Quote No: <quotation_id>Quote 1: <quote text>[hr]Related Quotes:related quote id 1related quote 1related quote id 2related quote 2.....................[hr]<previous page> <next page>[/quote]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.Regards,underwinefx Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.