#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    3
    Rep Power
    0

    Smile Unknown column 'priser.pr_id' in 'on clause'


  2. #2
  3. No Profile Picture
    Problem Solver
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jan 2001
    Location
    Stockholm, Sweden
    Posts
    4,495
    Rep Power
    534
    There is no "priser" table present in your query hence the error message -"Unknown column 'priser.pr_id' ".

    My guess is that you don't want to perform a self join so the table in the second join should be "priser" like this instead:
    Code:
    SELECT
    p1.p_id,
    p1.p_titel,
    p1.p_kunstner,
    p1.p_oprettet,
    image_url.img_url,
    genre.g_navn,
    priser.pr_pris
    FROM
    produkter AS p1
    INNER
      JOIN
        priser
        ON p1.p_FK_pris = priser.pr_id
    INNER
      JOIN
        image_url
        ON image_url.img_FK_products = p1.p_id
    INNER
      JOIN
        genre
        ON p1.p_FK_genre = genre.g_id
    /Stefan
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    3
    Rep Power
    0
    hmm....
    yeah, working now... lol..

    should have seemed that one comming...
    anyways... working now, almost...

    now they WONT getting out...
    freaking annoying...

    CODE:

    PHP Code:
    <?php
    $bg 
    '';// variablen $bg oprettes og er tom.
    /*p1 = Aliases instead of (produkter)...*/
    $query_produkter "
    SELECT
        p1.p_id,
        p1.p_titel,
        p1.p_kunstner,
        p1.p_oprettet,
        image_url.img_url,
        genre.g_navn,
        priser.pr_pris
    FROM
        produkter AS p1
            INNER JOIN priser ON p1.p_FK_pris = priser.pr_id
            INNER JOIN image_url ON image_url.img_FK_products = p1.p_id
            INNER JOIN genre ON p1.p_FK_genre = genre.g_id"
    ;
    $result_produkter mysql_query($query_produkter)or die(mysql_error());
    ?>
    <table class="butikliste_tableshow">
    <tr>
    <td>&nbsp;</td>
    <td>KUNSTNER</td>
    <td>TITEL</td>
    <td>GENRE</td>
    <td>OPRETTET</td>
    <td>PRIS</td>
    <td>K&Oslash;B</td>
    </tr>
    <?php
    while($produkter_row mysql_fetch_array($result_produkter))
    {
        
    $bg = ($bg == '' '#999999' '');//skal antages som en if/else saetning...
        
    echo "<tr bgcolor='$bg'>";
        
        echo 
    "<td>"."<img src='50x50/".$produkter_row['img_url']."' />"."</td>";
        echo 
    "<td>"."<a href='butik_detalje.php?pid=".$produkter_row['p_id']."'>".$produkter_row['p_kunstner']."</a>"."</td>";
        echo 
    "<td>".$produkter_row['p_titel']."</td>";
        echo 
    "<td>".$produkter_row['g_navn']."</td>";
        echo 
    "<td>".$produkter_row['addeddate']."</td>";
        echo 
    "<td>".$produkter_row['pr_pris']."</td>";
        echo 
    "<td>"."<a href='#'><img src='styles/images/kurv.png' /></a>"."</td>";
        
        echo 
    "</tr>";
    }
    //While Statement ends...
    ?>
    </table>
    Ideas?...
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Mar 2008
    Posts
    1,927
    Rep Power
    378
    "now they WONT getting out..."

    I'm not sure what this means, so not sure how to respond.

    For problems with MySQL queries, it's often helpful if we're able to replicate your scenario, so consider providing CREATE and INSERTs for each of the relevant tables, together with the result set you'd expect from your query.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    3
    Rep Power
    0
    ok lol... i should take a knife and put my heart out of my boddy...

    i had no SQL rows inside produkter table... lol...
    working 100% now -.-'...

    sorry for waste of time :P...
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Mar 2008
    Posts
    1,927
    Rep Power
    378
    On this occasion, that might be a step too far.

IMN logo majestic logo threadwatch logo seochat tools logo