SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru Majglow's Avatar
    Join Date
    Aug 1999
    Location
    B-Town
    Posts
    645
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Getting results from mysql after a join

    Hello,

    I have this problem with php/mysql. Here is the query:
    Code:
    SELECT s.ID, u.ID FROM Sites AS s, Users AS u WHERE s.Cross = u.Cross
    Ok, so, then I do the whole put results in an array bit, but how do I get the values? If the row is in the array $array, what is the key for s.ID and u.ID? Would they both be $array['ID']?



    Please help, Thanks,
    cArl
    Ohai!

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Change

    Code:
    SELECT s.ID, u.ID FROM Sites AS s, Users AS u WHERE s.Cross = u.Cross

    Code:
    SELECT s.ID as SID, u.ID as UID FROM Sites AS s, Users AS u WHERE s.Cross = u.Cross
    And access them as $array[SID] and $array[UID]
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Guru Majglow's Avatar
    Join Date
    Aug 1999
    Location
    B-Town
    Posts
    645
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thanks

    Thanks for the help

    I didn't know that I could do that, I guess I could have tried, but it didn't come to mind. The mysql documentation isn't that clear for somebody who isn't a SQL expert... and that's where I learn all my SQL.

    cArl
    Ohai!


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
  •