SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: mySQL syntax

  1. #1
    SitePoint Enthusiast Patrick Lucas's Avatar
    Join Date
    Dec 2001
    Location
    Ohio
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    mySQL syntax

    Hey,
    I know this must be a simple question... but I can't seem to figure it out.
    I am trying to select all rows were the column "category" is either '$sort' or 'all'. I also want it to sort the day too.
    I put down this:
    PHP Code:
    $sql "select * from calendar where date LIKE ('%$year-$month-$day%')&& category = ('all' OR '$sort');"
    However, the result from that makes it seem like it didn't even consider the "category = " part.
    Any help would be great
    Patrick Lucas

  2. #2
    epsilon transition cupid's Avatar
    Join Date
    Aug 2001
    Location
    Kent, Ohio
    Posts
    367
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:

    Try:

    $sql "select * from calendar where date LIKE ('%$year-$month-$day%') && (category='all' || category='$sort')"

  3. #3
    SitePoint Enthusiast Patrick Lucas's Avatar
    Join Date
    Dec 2001
    Location
    Ohio
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh, hehe. I thought it was something simple like that.

    Thanks for the help
    Patrick Lucas

  4. #4
    epsilon transition cupid's Avatar
    Join Date
    Aug 2001
    Location
    Kent, Ohio
    Posts
    367
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


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
  •