Jump to content

Search Engine+Flat File


ktuluxx

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/140893-search-engineflat-file/
Share on other sites

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.

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 :P

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.