SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: MySQL Question

Hybrid View

  1. #1
    Rusted & Weathered HumanClay's Avatar
    Join Date
    Sep 2000
    Location
    Milwaukee, WI
    Posts
    225
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have a char field called Ads in my table... the field contains the sort of Ads that are placed on pages. The field will either have one or a combination of the following:

    - None
    - Frame
    - Delay
    - Banner
    - Pop-up

    I know ow you handle a SELECT statement if searching for records with None in the Ads field, but if one record had the following in the Ads field: "Frame Delay" meaning that either a Frame of Delay ad is used, how would I be able to search for "Frame" and still be able to pull records that contained "Frame Delay" from the table? What, if possible, would the SQL statement look like?
    Steve Caponetto - [profile] [e-mail]
    CreedFeed.com - feed your need for Creed!

  2. #2
    Rusted & Weathered HumanClay's Avatar
    Join Date
    Sep 2000
    Location
    Milwaukee, WI
    Posts
    225
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think I just figured it out

    I added % to the search term...

    if you searched for "Frame" I just made it "Frame %" and it listed records with "Frame Delay"
    Steve Caponetto - [profile] [e-mail]
    CreedFeed.com - feed your need for Creed!

  3. #3
    Serial Publisher silver trophy aspen's Avatar
    Join Date
    Aug 1999
    Location
    East Lansing, MI USA
    Posts
    12,937
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes. A % sign is the wildcard figure for SQL.

    If you had a DB of names and wanted to return all of them that started with A you'd search for A%. Or all of the ones that ended with A you'd search for %A. Or if you just wanted all names you'd search for %.

    Chris Beasley - I publish content and ecommerce sites.
    Featured Article: Free Comprehensive SEO Guide
    My Guide to Building a Successful Website
    My Blog|My Webmaster Forums

  4. #4
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Steve, from the description of what your field is supposed to do, it sounds to me like you should be using a SET column, not a CHAR column.
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference

  5. #5
    Rusted & Weathered HumanClay's Avatar
    Join Date
    Sep 2000
    Location
    Milwaukee, WI
    Posts
    225
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, I'm just learning MySQL and PHP... what is a SET? Can you point me to any good sites that list info like this (besides the docs on MySQL and PHP sites)
    Steve Caponetto - [profile] [e-mail]
    CreedFeed.com - feed your need for Creed!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •