trying to create a search engine but a bit stuck

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
proronen
Forum Newbie
Posts: 1
Joined: Wed Nov 10, 2010 9:01 pm

trying to create a search engine but a bit stuck

Post by proronen »

hello everyone!


i am trying to build by myself a search engine in my site and i got to a point where i access the sql.

i want to search in the site by tags, so what i did is to get to the tags inside the table and the the farest i could reach is a situation like this:

(just for exmple)

line 1:banana,apple,pear,potato
line 2:bike,car,tank,house
line 3:girls,boys,cats,dogs
line 4:ummbrella,computer,laptop,keyboard

and a thousend more lines like this.

so what i wanted to do is to expolde those lines by explode(",", $something)

but the problem is that it tells me it is an array.

line 1:array
line 2:array
line 3:array
line 4:array
......


how can i access each to explode them and search through them?


thanks all! :) ronen.
dheeraja
Forum Commoner
Posts: 36
Joined: Tue Nov 09, 2010 11:03 pm

Re: trying to create a search engine but a bit stuck

Post by dheeraja »

When you use an explode function it breaks your content to an array.
E.g
you have a string say :

Code: Select all

$fruits = "banana,orange,apple,mango";
$fruits = explode(",", $fruits);
Now the output stored in $fruits as an array, & if you want to access all fruits then u have to use
$fruits[0] for banana, $fruits[1] for orange and like wise...
Post Reply