ktuluxx Posted January 15, 2009 Share Posted January 15, 2009 Hi, I am a noob here Anyhow, here are my question. I have a database in flat file which consist $var_one = "Whole wide world"; $var_two = "Everything you need"; $var_three = "Might be true"; In another file, let say index.php. It will call the db file. Let say index.php just have this code : <?php echo $var_one ?> How do I make search engine that looks for the variable in the database and display the file which associated with the term entered? Meaning that if people search for term "whole", it will display index.php as a link and user can click the link. Pardon my way of saying things.. I just not good at asking question. Thanks in advanced. Quote Link to comment https://forums.phpfreaks.com/topic/140893-search-engineflat-file/ Share on other sites More sharing options...
ngreenwood6 Posted January 15, 2009 Share Posted January 15, 2009 That is a little more complicated than you may think that it is. Why don't you use a database? Also, this forum is to help you with code when you run into problems. No one is going to code something for you if you come up with something yourself someone will be more than willing to help you out when you run into problems. Quote Link to comment https://forums.phpfreaks.com/topic/140893-search-engineflat-file/#findComment-737457 Share on other sites More sharing options...
ktuluxx Posted January 15, 2009 Author Share Posted January 15, 2009 Actually I have problem using the database..Let just say I can't use it..not that I don't want to. Yes you are right. I should post some of my work instead asking for the whole solution. I'll be back as soon I find out some of it. Quote Link to comment https://forums.phpfreaks.com/topic/140893-search-engineflat-file/#findComment-737463 Share on other sites More sharing options...
ngreenwood6 Posted January 15, 2009 Share Posted January 15, 2009 Actually I have problem using the database..Let just say I can't use it..not that I don't want to. Is this because you don't know how to or are having a problem setting it up? Quote Link to comment https://forums.phpfreaks.com/topic/140893-search-engineflat-file/#findComment-737467 Share on other sites More sharing options...
ktuluxx Posted January 15, 2009 Author Share Posted January 15, 2009 Actually I have problem using the database..Let just say I can't use it..not that I don't want to. Is this because you don't know how to or are having a problem setting it up? I do know how to set it up. Problem is my admin does not want me using the database. I really do not understand that part myself. The only solution left is using flat file database. As for the search engine. Currently working on it until I got stuck. Hope somebody will lend me a hand Quote Link to comment https://forums.phpfreaks.com/topic/140893-search-engineflat-file/#findComment-737527 Share on other sites More sharing options...
.josh Posted January 15, 2009 Share Posted January 15, 2009 You can't just echo $var_one and expect it to automatically search for it in your flatfile. Variables only hold data. You can have that data be code and then eval it if you really want to, but then you'd have to have one for every single variable in there. you can write some code to load them into an array (or individual vars) so they would all be loaded up. Or you can make a function that searches through the file and grabs the value and returns it, each time it is called. Or you can make a class that does the same thing. Quote Link to comment https://forums.phpfreaks.com/topic/140893-search-engineflat-file/#findComment-737532 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.