SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict RapidGaming's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    204
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    A little problem which is confusing me!

    PHP Code:
    $secondaryget mysql_db_query($db_bas "SELECT fileid FROM `cart` WHERE `id` = '$uid' OR `id` = '$uid2'") or die(mysql_error());;
    while(
    $row mysql_fetch_array($secondaryget)) {
    $fid $row['fileid'];
    $mainget mysql_db_query($db_bas "SELECT * FROM `download` WHERE `id` = '$fid'") or die(mysql_error());
    while(
    $select mysql_fetch_array($mainget)) { 
    That is what I have, I'm pretty sure it's crap and incorrect but anyway this is what I need to do!

    I need to select the fileid from cart where id = $uid or id = $uid2. Then, with the results from that query I need to select * from download where id = $fid and the fid is the row fid from the above query.

    Get what I mean?

    Thanks!

  2. #2
    SitePoint Addict RapidGaming's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    204
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's slowing disappearing so bump

  3. #3
    SitePoint Addict RapidGaming's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    204
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ..and again, sorry about the bumps, just need to figure it out.

    Thanks!

  4. #4
    Non-Member coo_t2's Avatar
    Join Date
    Feb 2003
    Location
    Dog Street
    Posts
    1,819
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    What's the problem you're having? Is the query dying? If so what's the error. Are the "id" fields integer types? If so you shouldn't quote them, although I don't know if that would make the query die.
    I'd also try it without back quotes around the field names. Not sure that makes a difference either, but I'd try it without them.

    --ed

  5. #5
    SitePoint Zealot
    Join Date
    Sep 2002
    Location
    Calgary
    Posts
    160
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you can do the query in one.

    SELECT * from download a, cart b where a.fileid = b.id and a.id = '$uid'

    One thing about this. becuase you have 2 id, from both a and b. you are going to need to identify which id is which. (That goes for any duplicate name in the tables)

    select a.id, b.id, a.name, b.name from download a, cart b where a.fileid = b.id a.id = '$uid'

    Let me know if this works.


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
  •