Forum Moderators: coopster
Can I do an entire site search using a keyword (or keywords) using PHP but the search should search through the contents of the databases, as well as HTML and PHP files in one pass (meaning I'll type the keyword and the script will search for it on the databases, HTML, and PHP files that I have)?
I am doing a site that has some files (PHP) included (because the content is long and I think that it should not be inside a database), and some are in the database (because the content to be displayed is short).
So what I want to happen is when somebody does a search, they just type in the keyword and the script would do the search through all the different databases (and tables), as well as in the HTML and PHP files that I include?
I hope that my question is clear.
Also, can you point me to a resource where I can do more reading on this preferrably online because books cost a lot in this side of the globe.
Thanks again.
Forever newbie,
Francis
You may want to make sure that you massage your data a bit before you put it in the database. Blow away all the html tags and such as you don't really need to store it and most people won't be searching for 'href' in a web page unless they can actually see it :-)
I've also thought of putting the entire thingamajig on the database, however, the content would contain links (thus the href). The contents would basically be laws (such as Presidential Decrees, etc., so the content of one record would be reaaaaalllly long. Any suggestions on how to go about with this?
Also, can I do multiple table search? Or at the very least any idea how to do it?
Mark_A,
Thanks a lot for the links. I'll check them out and look for answers.
Francis...
You really don't have to worry about the amount of data that gets stored in the record. Mysql can handle it just fine ;-)
As far as doing multiple table searches goes I guess I'd have to know more about what it is you want to do. At a minimum you can pull back a record from one table and while you are in a while getting the data you can do something else with the data to another table.
[edited by: jatar_k at 5:05 pm (utc) on Sep. 5, 2003]
[edit reason] disabled smileys [/edit]
What I want to happen is if somebody conducts a search by typing a keyword, for example, if somebody types in the word "constitution", the search would go through all the different tables looking for the keyword, and the output would be like:
Linked Title
Description (which could be based on the first 50 text of the page)
That's it... at least for the first few parts of my problem.
Thanks a lot for the patience and help.
If I understand correctly then you could pull the reults back easy enough.
Do something like:
$query = "select whatever from wherever1 where something = 'something' limit 2";
$rs = @mysql_query($query);
if(mysql_num_rows($rs)>0){
while($resultset = mysql_fetch_array($rs)){
do something here
}
}
$query = "select whatever from wherever2 where something = 'something' limit 2";
$rs = @mysql_query($query);
if(mysql_num_rows($rs)>0){
while($resultset = mysql_fetch_array($rs)){
do something here
}
}
...and so on until you have gone through all your tables. I just put a limit of 2 as an example. Does that help?
Here is the situation: I want to create an <A HREF> but the link is inside the database. For example, I have a link text XYZ with visible link library.php?db=acts&tid=a3815 (when you point to it on the browser). However, the actual link, referenced by a3815 is stored inside the database.
How can I "call" the link from inside the database? So that when I click on XYZ on the browser, it would go into the database, check for the reference and then go to the link without opening another browser?
I hope this is clear. Thanks again for the help....