The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Databases
> MySQL Help
|
Unknown column 'priser.pr_id' in 'on clause'
Discuss Unknown column 'priser.pr_id' in 'on clause' in the MySQL Help forum on Dev Shed. Unknown column 'priser.pr_id' in 'on clause' MySQL Help forum discussing administration, SQL syntax, and other MySQL-related topics. MySQL is an open-source relational database management system (RDBMS).
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

October 5th, 2012, 03:15 AM
|
|
Registered User
|
|
Join Date: Oct 2012
Posts: 3
Time spent in forums: 1 h 38 sec
Reputation Power: 0
|
|
Unknown column 'priser.pr_id' in 'on clause'
|

October 5th, 2012, 03:42 AM
|
|
Problem Solver
|
|
Join Date: Jan 2001
Location: Stockholm, Sweden
|
|
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
|

October 5th, 2012, 03:58 AM
|
|
Registered User
|
|
Join Date: Oct 2012
Posts: 3
Time spent in forums: 1 h 38 sec
Reputation 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> </td>
<td>KUNSTNER</td>
<td>TITEL</td>
<td>GENRE</td>
<td>OPRETTET</td>
<td>PRIS</td>
<td>KØ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?...
|

October 5th, 2012, 04:07 AM
|
|
|
|
"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.
|

October 5th, 2012, 04:48 AM
|
|
Registered User
|
|
Join Date: Oct 2012
Posts: 3
Time spent in forums: 1 h 38 sec
Reputation 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...
|

October 5th, 2012, 05:10 AM
|
|
|
|
On this occasion, that might be a step too far.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|