Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Searching in php.............need help.
Old 03-17-2010, 04:19 AM Searching in php.............need help.
Isabella_Smith's Avatar
Ultra Talker

Posts: 285
Trades: 0
Hi,

I am working on a search panel in php......................there are some company names in my database for example....

Loyal Tailors
Loyal Book Depot
Loyal Advisors

I want to make a query in which if I am going to search by keyword "LOYAL" it should show all the results having business name loyal inside.

I am doing something this......

PHP Code:
$bizbrk $biznam;
           
$bizbr explode(" "$brk);     
           
$sql_category="select * from tblbusiness where biz_name like '$bizbr[0]%' or '$bizbr[1]%'"
The result come up with irrelevant records........Please help.

Any suggestions would be appreciated.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
buy all indian salwar Kameez, Sarees and clothes
Isabella_Smith is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-17-2010, 04:32 AM Re: Searching in php.............need help.
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
PHP Code:
where biz_name like '$bizbr[0]%' or  biz_name like '$bizbr[1]%'" 
Your LIKE query will ONLY match the start of the column value BTW
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-17-2010, 05:10 AM Re: Searching in php.............need help.
Isabella_Smith's Avatar
Ultra Talker

Posts: 285
Trades: 0
Quote:
Originally Posted by chrishirst View Post
PHP Code:
where biz_name like '$bizbr[0]%' or  biz_name like '$bizbr[1]%'" 
Your LIKE query will ONLY match the start of the column value BTW

Will this work....???

Let me know if there any better string I can use for this....
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
buy all indian salwar Kameez, Sarees and clothes
Isabella_Smith is offline
Reply With Quote
View Public Profile
 
Old 03-17-2010, 05:21 AM Re: Searching in php.............need help.
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
Will this work....???
Test it on YOUR data.


Quote:
Let me know if there any better string I can use for this....
There maybe, it will depend on what you actually want to achieve.

With the information given,
SELECT columnlist FROM table WHERE column LIKE 'word%'; should work.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Searching in php.............need help.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13992 seconds with 12 queries