Hello everybody!
I am trying to figure this out since a few days ago. I have 3 tables: customers, articles and orders. the orders table contains rows with three columns: order number, customer number and article number (the last two columns are set as master keys in the two other tables).
Now i am trying to display the information which is saved in the customers and articles table:
[php]
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("Kleine Firma", $con);
$result = mysql_query("SELECT * FROM tblbestellungen");
while($row = mysql_fetch_array($result))
{
$_kunde = $row['KuNR'];
$_artikel = $row['ArtNR'];
$_k = mysql_query("SELECT KuVorname, KuNachname, KuOrt FROM tblkunden WHERE KuNR='$_kunde'");
$_a = mysql_query("SELECT ArtName, ArtFarbe, ArtPreis FROM tblartikel WHERE ArtNR='$_artikel'");
echo "
" . $row['KuNR'] . " " . $_k['KuVorname'] . " " . $_k['KuNachname'] . " " . $_k['KuOrt'] . " | ";
echo "" . $row['ArtNR'] . " " . $_a['ArtName'] . " " . $_a['ArtFarbe'] . " " . $_a['ArtPreis'] . " |
";
}
mysql_close($con);
?>
[/php]
I am not familiar with the mysql syntax (as you can see), most of the stuff is copied from w3schools tutorials.
Please help me solving my problem