0

please i need to query 2 tables at once and display the content in table. here is the code:

<?php
                   include 'database.php';
                   $pdo = Database::connect();
                   $sql = 'SELECT producs.*,validation_superviseur.* FROM products ORDER BY product_id DESC ,validation_superviseur ORDER BY id DESC';
                   foreach ($pdo->query($sql) as $row) {
                            echo '<tr>';
                            echo '<td>'. $row['cat_id'] . '</td>';//this is retrieved from TABLE products

                            echo '<td><a href="details.php?brand_id='. $row['brand_id']. '">'. $row['brand_id']. '</a></td>';// this is retrieved from TABLE products

                            echo '<td>'. $row['product_title'] . '</td>';//this is retrieved from TABLE products
                            echo '<td>'. $row['product_img1'] . '</td>';//    this is retrieved from TABLE products

                            echo '<td>'. $row['reaction'] . '</td>';  //  this is retrieved from TABLE validation_superviseur                 
                            echo '</tr>';
                   }
                   Database::disconnect();
                  ?> 
3
Contributors
3
Replies
15
Views
1 Year
Discussion Span
Last Post by drjohn
0

And what problem are you having?
Is it the typo in 'select producs.' in your SQL statement? Or something else?
Seeing as your only using a few of the selected columns you can change your query from selecting all to just the ones you need. ut that won't fix the undescribed problem you're having, it's just a tip - Selecting all every time is just lazy ;)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.