SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast snarzom's Avatar
    Join Date
    Jan 2007
    Posts
    64
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    allow user to view more than one postcode (was "help with query")

    below is the query i have to allow people into view cetain info per postcode. what im stuck on is if i allow them to view more than 1 postcode in there admin area how do i go about that. At the moment if i give them 0800 they can only view results with 0800, but i want to be able to add more than 1 if need be eg: 0800 and 0801

    Code:
     SELECT `user`.username, `user`.postcode, `form`.userID, `form`.added_by, `form`.email, `form`.phone, `form`.mobile, `form`.address, `form`.suburb, `form`.postcode, `form`.`state`, `form`.`datetime` FROM `user` inner join `form` on `user`.postcode = `form`.postcode WHERE `user`.username = '".$HTTP_SESSION_VARS['usersession']."'ORDER BY userID DESC";

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,350
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Code:
    WHERE user.postcode IN ( 800, 801 )
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Enthusiast snarzom's Avatar
    Join Date
    Jan 2007
    Posts
    64
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes but i want it to get the postcodes from the ones put into there login details. i cant put in the form field user.postcode 0800, 0801

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,350
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    okay, sorry, in that case i don't know what you're doing
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  5. #5
    SitePoint Enthusiast snarzom's Avatar
    Join Date
    Jan 2007
    Posts
    64
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i try to explain a bit clearer. i have a admin area, where they can add users to view listings by postcode. they get username eg: test, password eg: test post code. eg:0800. When they login they go to there page with listings for that postcode eg 0800. But if they need to view two post codes eg: 0800, 0801, how do i allow them to view them. the current query only allows for 1 postcode to be viewed at. if in the admin i put 0800, 0801 it shows no data, but if i only have 0800 it shows. Any ideas

  6. #6
    SitePoint Enthusiast snarzom's Avatar
    Join Date
    Jan 2007
    Posts
    64
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can anyone help or point me in the right direction??


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
  •