Jump to content

Problem join roster product and rental


kees mulder

Recommended Posts

I can't get it working. I want a list with al the products (in the table producten) witch is free or with rental. This is the script:

 

<?php

include "connectdb.php";

include "errordb.php";

?>

 

<HTML>

<HEAD>

<TITLE></TITLE>

 

<link rel="STYLESHEET" type="text/css" href="../screen.css">

 

<body>

 

 

<table border=1>

<tr><td>Tijd</td><td>Product</td></tr>

<?php

 

$query=mysql_query("

    SELECT

        producten.productcode,

        producten.productnaam,

        producten.merkcode,

        agenda.datum,

        agenda.productcode,

        agenda.tijd

    FROM

        producten

    LEFT JOIN   

        agenda ON agenda.product_code = producten.productcode

    WHERE

        agenda.datum = '2008-12-30' OR agenda.datum IS NULL

    ORDER BY

        producten.productcode ASC") or die (error($query, $HTTP_SERVER_VARS['PHP_SELF']));

 

    While ($row = mysql_fetch_assoc($query))

    {

        $productnaam = $row['productnaam'];

        $productcode = $row['productcode'];

        $tijd = $row['tijd'];

 

        echo "<tr><td>$tijd</td><td>$productcode - $productnaam</td></tr>";

    }

    mysql_free_result($query);

 

?>

</table>

 

</BODY>

</HTML>

 

 

If I choose '2008-12-31' this is the list:

 

Time            Product

13.00 - 18.00 1 - Hamer

                  2 - Hamer

09.00 - 12.00 3 - Zaag

13.00 - 18.00 3 - Zaag

                  4 - Tang 1

09.00 - 18.00 5 - Tang 2

                  6 - Tang 3

 

If i choose '2008-12-30' the list shows:

Time            Product

                  2 - Hamer

                  4 - Tang 1

                  6 - Tang 3

13.00 - 18.00 7 - Tang

12.00 - 18.00 8 - Zaag 1

 

But in the two list I can't see the whole list with products!? What do i wrong?! I want to see:

 

2008-12-31

Time            Product

13.00 - 18.00 1 - Hamer

                  2 - Hamer

09.00 - 12.00 3 - Zaag

13.00 - 18.00 3 - Zaag

                  4 - Tang 1

09.00 - 18.00 5 - Tang 2

                  6 - Tang 3

                  7 - Tang

                  8 - Zaag 1

 

OR

2008-12-30

Time            Product

                  1 - Hamer

                  2 - Hamer

                  3 - Zaag

                  4 - Tang 1

                  5 - Tang 2

                  6 - Tang 3

13.00 - 18.00 7 - Tang

12.00 - 18.00 8 - Zaag 1

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/138874-problem-join-roster-product-and-rental/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.