SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2005
    Posts
    97
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    many numbers in 1 variable

    How can I make this possible $post = '1,2,3,5';
    and use the echo '$post' so it will return 1,2,3,5

  2. #2
    SitePoint Guru aamonkey's Avatar
    Join Date
    Sep 2004
    Location
    kansas
    Posts
    953
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    confused........in your example, is $post an array???

  3. #3
    SitePoint Member
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i think hes asking - how do you use array's

  4. #4
    SitePoint Evangelist djdykes's Avatar
    Join Date
    Feb 2005
    Location
    Chester, Cheshire
    Posts
    565
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  5. #5
    SitePoint Enthusiast
    Join Date
    Apr 2005
    Posts
    97
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I need to use this so I can configure what tablenames/id I want to show in a query.
    Thats why I need the numbers (1, 2, 5, 7) or something like that.
    SELECT L.LINKID, L.LINKNAVN, L.URL, K.KATNAVN FROM omc_lenker L INNER JOIN omc_lkategori K ON K.KATID = L.KATID WHERE L.KATID IN (1, 2)

    So I can use a $something instead of 1, 2 at the end.

  6. #6
    SitePoint Evangelist djdykes's Avatar
    Join Date
    Feb 2005
    Location
    Chester, Cheshire
    Posts
    565
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:

    $values 
    = array(12345  );

    $something $values[0] . ", " $values[1] . ", "$values[2] . ", " $values[3] . ", " .$values[4];

    echo 
    $something
    Like that? that would output whatever was in that array in this case 1,2,3,4,5

    if you post your code it will give a better idea of what you're trying to acheive.

  7. #7
    SitePoint Enthusiast
    Join Date
    Apr 2005
    Posts
    97
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $sql = 'SELECT L.ID, L.LINKTEKST, L.LINK, K.KATNAVN FROM omc_lenker L INNER JOIN omc_lkategori K ON K.KATID = L.KATID WHERE L.KATID IN ('$something') ORDER BY L.KATID';

    But I want to make it possible for the user to chose which categories he wants to show on the page. That's why I need a $something with the categorie id to display.


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
  •