Anakha92 Posted March 26, 2007 Share Posted March 26, 2007 Okay, I have this nice script for a database, but now, I was wondering how do i get it to work as a database? Do I save is as a regular or html file, or do I do something else? Also once I have my database working, how on earth would I go about making a search engine to search that database? Thanks for any help Link to comment Share on other sites More sharing options...
Anakha92 Posted March 26, 2007 Author Share Posted March 26, 2007 Basically, what i'm wondering first, is whether or not the database script is placed in a empty html document and saved as such, or perhaps the database has a unique file type? Link to comment Share on other sites More sharing options...
Anakha92 Posted March 26, 2007 Author Share Posted March 26, 2007 Well, I'm off to bed.Please post what you can to help me even while I'm sleeping, and I will reply ASAP.Thanks in advance for any help Link to comment Share on other sites More sharing options...
jlhaslip Posted March 26, 2007 Share Posted March 26, 2007 I have this nice script for a database we need to see the 'script'. Link to comment Share on other sites More sharing options...
Anakha92 Posted March 26, 2007 Author Share Posted March 26, 2007 I got this from http://www.htmlgoodies.com <!-- Begin copyright - This must be retained and posted as is to use this script -->// This Script was created by Satadip Dutta. // Email: sat_dutta@post1.com / satadipd@inf.com // URL:http://www.angelfire.com/sd/dutta// Please honor my hard work, if you use a variant of this in your page, // then please email me :) and keep these comments in the Script.// This code is Copyright (c) 1997 Satadip Dutta// all rights reserved.// License is granted to user to reuse this code on their own Web site // if, and only if, this entire copyright notice is included. The Web Site// containing this script must be a not-for-profit ( non-commercial ) web site. If the script is to be used in a commercial // website exclusive permission must be obtained before using it.// Joe Burns of htmlgoodies.com has been authorised to use this code in the// site htmlgoodies.com.<!-- End copyright - This must be retained and posted as is to use this script -->title = new Object();desc = new Object();links= new Object();matched= new Object();keywords= new Object();found= new Object();var temp=0;// actual location or the item to be searched// description of he location// actual link// percentage match found// keywords as parsed from the input// # of titles present in the databasetitle[0]=6//no of keywords after parsingkeywords[0]=0//no of matches found.found[0]=0<!-- Begin List of Searchable Items -->title[1]="award awards"desc[1]="The HTML Goodies Site Awards"links[1]="http://dutta.home.ml.org"matched[1]=0title[2]="yahoo search engine"desc[2]=" the yahoo search engine "links[2]=" http://www.yahoo.com"matched[2]=0title[3]=" lycos search engine"desc[3]="The lycos search engine "links[3]=" http://www.lycos.com"matched[3]=0title[4]=" infoseek search Engine"desc[4]="The Infoseek Search Engine "links[4]=" http://www.infoseek.com"matched[4]=0title[5]="goodies java script video html scanning links academic joe burns"desc[5]="The HTML Goodies Domain - Home Page"links[5]="http://www.htmlgoodies.com"matched[5]=0title[6]="java scripts submit html goodies color text scrolling text display javascript"desc[6]="Java Goodies - Striving to be the largest collection of Java Scripts on the World Wide Web"links[6]="http://www.htmlgoodies.com/javagoodies/"matched[6]=0<!-- End list of Searchable items -->function search(){// get the input from the input by the user and strip it into keywords//+var skeyword=document.searchengine.keywords.value.toLowerCase();var check=1;var pos=0;var i=0;var j=0;var itemp=0;var config='';while (true) { if (skeyword.indexOf("+") == -1 ) { keywords[check]=skeyword; break; } pos=skeyword.indexOf("+"); if (skeyword !="+") { keywords[check]=skeyword.substring(0,pos); check++; } else { check--; break; } skeyword=skeyword.substring(pos+1, skeyword.length); if (skeyword.length ==0) { check--; break; } }// the keywords have been put in keywords object.keywords[0]=check;//alert(check);// matching and storing the matches in matchedfor ( i=1; i<=keywords[0];i++) { for (j=1;j<=title[0];j++) { if (title[j].toLowerCase().indexOf(keywords[i]) > -1 ) { matched[j]++; } } }// putting all the indexes of the matched records in foundfor (i=1;i<=title[0];i++){ if (matched[i] > 0 ) { found[0]++; // increment the found found[found[0]]=i; } }//alert("found 0 " + found[0]);// sort the list as per max percentage of matchesfor (i=1;i<=found[0]-1;i++) { for(j=i+1;j<=found[0];j++) { if ( matched[found[i]]< matched[found[j]] ) { temp= found[j]; found[j]=found[i]; found[i]=temp; } } }// end of sort// prepare for document write.config='toolbar=no,location=no,directories=no,status=no,menubar=no,' config += 'scrollbars=yes,resizable=yes' output = window.open ("","outputwindow",config) output.document.write('<title> Goodies Search Results </title>');output.document.write('<BODY bgcolor=#ffffff text=#000000 link=#990099 vlink =#339966 >');output.document.write('<center> <h1>Goodies Search Results </h1></center>'); output.document.write('<hr>');output.document.write(' The Keyword(s) you searched :: '.big() )for (i=1; i<=keywords[0]; i++) { output.document.write( keywords[i].bold() +" "); }output.document.write('<br>');if (found[0]==0) { //alert(found[0]); output.document.write('<hr>'); output.document.write("<b>No matches resulted in this search </b> <br>"); output.document.write("You may close the results and reduce the length/number of the keywords <br>"); }else { // data has been found output.document.write(" <hr> <b> The Results of the search are : </b> "); output.document.write( found[0] +" Entries found ".italics()); output.document.write("<table border=1 width=100%>"); for (i=1; i<=found[0];i++) { output.document.write("<tr><td valign=top bgcolor=#9999ff>"); output.document.write("<h3>" +i +"</h3>"); output.document.write("<td valign=top>"); itemp=found[i]; output.document.write(desc[itemp].bold() +"<br>" +links[itemp].link(links[itemp])+"<br>"); temp= (matched[itemp]/keywords[0])*100 output.document.write("<i> Matched with keywords :: " +temp+" % </i>" ); matched[itemp]=0 } found[0]=0; output.document.write("</table>"); }output.document.write ('This search was created by © <a href="http:\\dutta.home.ml.org"> Satadip Dutta</a> 1997');output.document.write ("<hr>");output.document.write ("<form><center>") output.document.write ("<input type='button' value='Start Another Search' onClick = 'self.close()'>") output.document.write ("</center></form>") }</script> If you do anythin with this please keep the makers copry rights in place Link to comment Share on other sites More sharing options...
justsomeguy Posted March 26, 2007 Share Posted March 26, 2007 That is a Javascript file, so it would make sense to save it as .js. You would add it to an HTML page like this:<script type="text/javascript" src="script.js"></script>But, just to be clear, this isn't a database. A database is a collection of data that is managed by a database management system, or DBMS. This is just a script with a data structure in it. The difference is that this data is read-only, you can't make changes to the data in this script, and also databases do not contain any executable code, only data. The second time you run this script, it will be exactly the same as the first time you run it, unless you edit the source code. With a database, you can just add and remove data using the DBMS with SQL statements like INSERT, UPDATE, and DELETE. This script just has a few arrays of various websites.Pretty much this entire script is a function called search. From the code, it looks like you need to create a form with an id of "searchengine", a textfield with an id of "keywords", and a submit button that will execute the search function. The search function will loop through the arrays that you see in the script, get a list of keywords that applies to each site, and try and determine which of the sites match the keywords that were entered.If you don't know how to use this script, I would suggest that you find some instructions or documentation that came along with it. When people write code like this and post it online, they will usually give some instructions on how to use it. However, due to the fact that this code is 10 years old and there are better ways to search through data, you might not be able to find any documentation. Link to comment Share on other sites More sharing options...
Anakha92 Posted March 26, 2007 Author Share Posted March 26, 2007 Lol, okay thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now