| | |
mySQL contains function?
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Jan 2009
Posts: 11
Reputation:
Solved Threads: 0
Ive been looking around and havent been able to find anything like this yet.. I am new to mySQL.
Im looking for a function like the "where" function of a query string.. but insted of it being exact i would like to select "where" datafield "contains" text..
example..
item is listed under multiple states
DB
id=1 name=apple state=FL, WI, CA
id=2 name=orange state=FL
when displaying results i would like to have apple come up when i select any of the states that it is listed under..
any questions?
Thanks,
-LTT
Im looking for a function like the "where" function of a query string.. but insted of it being exact i would like to select "where" datafield "contains" text..
example..
item is listed under multiple states
DB
id=1 name=apple state=FL, WI, CA
id=2 name=orange state=FL
when displaying results i would like to have apple come up when i select any of the states that it is listed under..
any questions?
Thanks,
-LTT
mysql Syntax (Toggle Plain Text)
SELECT name WHERE state LIKE '%s', $post['state']
php Syntax (Toggle Plain Text)
mysql_query(sprintf("select name where state like '%s', $post['state'] "));
wa fl az mi
instead of
wa, fl, az, mi,
many schema give commas a meaning, and cannot be sure where the data will be interpreted and parsed
the space character is a sufficient divider
MySQL Syntax (Toggle Plain Text)
%s , $post['state'] could be written as $post['state'] replaceable parameters that I need to know which ones are NUMERIC / TEXT / BLOB to debug, sql %s IS literal TEXT
Last edited by almostbob; Mar 5th, 2009 at 2:54 pm.
Failure is not an option It's included free
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
@almostbob : Rather than posting the exact queries as answer, why not just mention that MySQL contains something like 'LIKE' and then maybe point him towards the documentation page for the same and then let him do the further tasks, such as the syntax botheration for MySQL, PHP etc. Wouldn't the OP learn more things with this approach ?
Last edited by verruckt24; Mar 5th, 2009 at 2:52 pm.
Get up every morning and take a look at the Forbes' list of richest people. If your name doesn't appear.... GET TO WORK !!!
most do not want to be told
rtfmits easier for me its just another line of code, that I have in memory, references I have to waste my time looking up
Last edited by almostbob; Mar 5th, 2009 at 3:11 pm.
Failure is not an option It's included free
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
•
•
•
•
most do not want to be told - rtfm
And if you feel that your time is wasted, siting people references from which they can learn, then isn't not posting a good idea to consider ?
Last edited by verruckt24; Mar 5th, 2009 at 3:18 pm.
Get up every morning and take a look at the Forbes' list of richest people. If your name doesn't appear.... GET TO WORK !!!
•
•
Join Date: Feb 2009
Posts: 83
Reputation:
Solved Threads: 7
•
•
•
•
Then such people aren't worthy of telling anything at all. Because this community attempts to nurture an environment that makes people learn while helping them. Giving away readymade answers just because someone would not like you telling him "go-read-the-manual", isn't the right approach.
And if you feel that your time is wasted, siting people references from which they can learn, then isn't not posting a good idea to consider ?
Verruckt
the final arbitration of all takes up so much of your time.
It must be difficult to be you.
the final arbitration of all takes up so much of your time.
It must be difficult to be you.
Last edited by almostbob; Mar 7th, 2009 at 9:21 am. Reason: Don't like people
Failure is not an option It's included free
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
•
•
•
•
Verruckt
the final arbitration of all takes up so much of your time.
It must be difficult to be you.
•
•
•
•
hi..if anybody post new thread in forums means, its urgent to them...i think pointing to some referance manual is waste of time....Learning depends on their own interest..no body can force them...ok coool....enjoy & learn something by using this forumm..
Last edited by verruckt24; Mar 7th, 2009 at 9:53 am.
Get up every morning and take a look at the Forbes' list of richest people. If your name doesn't appear.... GET TO WORK !!!
![]() |
Similar Threads
- Function to return vat (MySQL)
- Connecting PHP to mySQL under IIS (PHP)
- Function ADD_DATE does not exist. (MySQL)
- Please help with JSP mysql update query (JSP)
- joining c variable with mysql (MySQL)
- How to search between two dates using mysql or php (PHP)
- running mysql from shell script (Shell Scripting)
- Inserting date in format DD-MM-YYYY in MySQL (MySQL)
- insert image into mysql (Visual Basic 4 / 5 / 6)
Other Threads in the MySQL Forum
- Previous Thread: Mysqlv9
- Next Thread: Lunerpages Hosting : Mysql connection problem using Navicat 8?
| Thread Tools | Search this Thread |
agplv3 alfresco amazon api artisticlicense aws bizspark breathalyzer camparingtocolumns changingprices cmg communityjournalism contentmanagement contractors copyright count court crm database design developer development distinct drupal dui ec2 email enterprise eudora facebook form foss gartner gnu government gpl greenit groupware hiring hyperic images innerjoins insert ip joebrockmeier join keyword keywords kickfire laptop law legal license licensing linux maintenance managing mariadb matchingcolumns metron micromanage microsoft microsoftexchange mindtouch montywidenius mozilla multiple music mysql mysqlcolumnupdating mysqldatetimeordermax() mysqlindex mysqlinternalqueries mysqlquery mysqlsearch news open-xchange opendatabasealliance opengovernment opensource oracle penelope priceupdating query referencedesign reorderingcolumns resultset saas select sharepoint simpledb sourcecode spotify sql sugarcrm syntax techsupport thunderbird transparency virtualization






