Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3
  1. #1
    Member
    Join Date
    Apr 2004
    Posts
    58
    Member #
    5497
    I am by no means new to PHP, just to MySQL. I know enough of MySQL to do everything I've needed to, but I have a question. How would I select a record if somewhere in it contains a variable?

    For instance, say you have a table with one of the fields being 'content'. You have three records, with the 'content' fields: 'hello this is a test', 'Testing...', 'hello world'.

    What query would you run to select just the records in which 'content' contains 'hello'. You couldn't use "SELECT * FROM mytable WHERE content = 'hello'", could you?

  2.  

  3. #2
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    Code:
    SELECT * FROM mytable WHERE content LIKE '%hello%';

  4. #3
    Member
    Join Date
    Apr 2004
    Posts
    58
    Member #
    5497
    Thanks.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 03:05 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com