Jump to content

Recommended Posts

let say we had a database of facebook.

 

Now let say we had two tables facebook_usera and another called

facebook_userb, and the two fields being searched are called users.

 

Now lets search the two table for the name john.

 

Is this valid to search the two database fields for user john.

<?php

$sql="SELECT facebook_usera.users as A,facebook_userb.users as B
       FROM facebook_usera, facebook_userb  WHERE A LIKE='john'
       OR B LIKE='john'";
?>

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/136414-solved-php-mysql-search-terms-syntax/
Share on other sites

No, invalid sql.

 

The following would work.

<?php

$sql="SELECT facebook_usera.users as userA,facebook_userb.users as userB
       FROM facebook_usera A, facebook_userb B  WHERE A.users LIKE '%john%'
       OR B.users LIKE '%john%'";
?>

Thank u

 

now how can u get the correct search where the search term is in alphabetical order.

 

in database u got 

 

ab

abbc

abbbc

 

If i wanted to search for ='%abby%' ill get returned abby only.

 

 

but i want any think shown in alphabetical order

 

any a words

any ab words

any abb words

 

So how do you get distinct  alphabetical searches and correct results...

 

please example be grate cheers mate... 

 

i want anything shown in alphabetical order relating to the search word.

 

 

 

 

Alphabetized

 

<?php

$sql="SELECT facebook_usera.users as userA,facebook_userb.users as userB
       FROM facebook_usera A, facebook_userb B  WHERE A.users LIKE '%john%'
       OR B.users LIKE '%john%' order by a.users, b.users";
?>

Last question and thank you.

 

 

Have you ever used this type of full text search if so what it all mean cheers..

 

yes i read the manual but the brain fried...

 

<?php

$sql="SELECT name, text, MATCH (text) AGAINST ('word1 word2 word3')

AS score FROM table1

WHERE MATCH (text) AGAINST ('+word1 +word2 +word3' in boolean mode) order by score desc";

?>

FullText is great as long as you have alot of data, if your search terms return more than 50% (i think its 50%) of the results, it comes out false (I think).

 

But I have not used FullText in a while, I am not exactly I can answer your question.

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.