Jump to content

PHP Search for friends problem


chrisC

Recommended Posts

Yes, you do.

 

<form action="search.php" method="post">
<br />
Enter Name:<br />
<input name="name" type="text" size="40"/>
<br />
And Or Enter Interests:<Br />
<input name="interests" type="text" size="40"/>
<br />
<input type="submit" name="submit" value="search"/>
</form>

 

Try that and see where it get's you.

 

EDIT:

A side note for why none of the other guy's solutions worked. Your form was passing "Friendsearch" and you were checking for "name" in your script. Since they are not the same, that is why your original did not work. It was always checking if name was = "" (or nothing). Since that was never being populated with data due to the inconsistencies of the names.

 

Just remember $_POST['index'] must correspond directly with your form input field names, or else it will not work/return nothing.

Link to comment
Share on other sites

  • Replies 53
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

ok, so the only trouble is, it will only find peoples interest if theres more than one person with the same?? does that make sence?

 

Also how can I get so that I can search for

 

Name,

Username

dob

Interests

 

Also another issue is when you only type in chris or any name it comes up with all the details fo everyone on the database

Link to comment
Share on other sites

ok, so the only trouble is, it will only find peoples interest if theres more than one person with the same?? does that make sence?

 

Also how can I get so that I can search for

 

Name,

Username

dob

Interests

 

Also another issue is when you only type in chris or any name it comes up with all the details fo everyone on the database

 

Use AND instead of OR in the implode function to limit that. If you typed in "chris" and someone has a name of "christopher" it would find it given the "LIKE" clause. I am not sure what your database consists of. To add dob and username simply follow the scheme I setup for the "name" and "interests" on the php side.

 

The OR keyword in MySQL says, Either This or This or This, where as and would be his name is this AND interests have to be this AND dob has to be this.

Link to comment
Share on other sites

hi guys, had to leave yesterday, currently dont understand what im doing wrong with respects to gettin correct search results

 

Currently I can type anyones name and get results for everybody, i want it so i can just get search results for the name and interest entered

 

any thoughts?

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • 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.