0

I have been stuck on something for quite a while now, I am creating a take-away system (pure as self learning). Although i'm trying to keep the learning curve go upwards by browsing the internet and look for solutions but I haven't found a solution for now.

I have two MYSQL tables named ; "Menu_Category" and "Menu_Dishes". I want to have a drop down menu when you're adding a dish, it gives you all the categories from Menu_category.

Menu_Category has the following columns Cat_id Category Comments Image State Created_by Created_at Updated_on Updated_by

Menu_Dishes has the following columns Dish_id Dish_name Dish_price Dish_comments Dish_image Dish_state Dish_Category

So technically speaking, should a inner join be used or should I twice use SELECT to two different databases? I'm currently completely lost..

        <?php
        $Category = $db->getValue ("Menu_Category", "Category");
        // select login from users
            echo $Category;
        ?>

This echo works and it shows one row, which is logic since the foreach isn't programmed, but I can't seem to get it to work..

Thanks for your help!

Darry

UPDATE

<?php $rows = $db->arraybuilder('Menu_Category');?>
<?php foreach ($rows as $row): ?>
<?php echo $row['Category']; ?>
<?php endforeach; ?>

I now have the following error code: Warning: Illegal string offset 'Category' in customers/5/0/d/mardesk.be/httpd.www/new/forms/dishes_form.php

1 Answers1

0

There must also be the cat_id value in the menu_dishes table. Then a left join solves the job.