I have 3 tables interlinked with each other.
store_manufacture -------------- Categories -------------------------- Store_Categories
----------------- -------------------- -----------------------
sm_id | sm_name cat_id | cat_name sc_id|store_id|cat_id
----------------- -------------------- -----------------------
12 | HP 1 | Travel 1 | 12 | 1
2 | Health 2 | 12 | 2
3 | Electronics 3 | 12 | 3
I want to display storename once with all the category ids which i have to post to the next page.Here is a code i have tried:
php
$cat_fetch=mysqli_query($con,"SELECT
sm_id,sm_brand_name,cat_id,sm_image,sm_link FROM `store_manufacture` sm
INNER JOIN store_category sc ON sc.store_id=sm.sm_id");
while($row=mysqli_fetch_array($cat_fetch,MYSQLI_ASSOC){
$id=$row['sm_id'];
echo " <h5> <a href=''>" .$row['sm_brand_name']." ". $row['cat_id']."</a></h5>";
}
Output
Desired Output
HP (Travel, Health,Electronics)
"SELECT
sm.sm_name,GROUP_CONCAT(c.cat_name) as cat_name FROM `store_manufacture` sm , Categories c, Store_Categories sc
where sm.sm_id = sc.store_id AND c.cat_id = sc.cat_id GROUP BY sm.sm_id";
this is query you should run hope this will help you
Firebase Cloud Functions: PubSub, "res.on is not a function"
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
I am new to php and MySQL and i have created several tables in my bd,
I need to change the default value of sql table fields from 'none' to 'null' where the datatypes are char varchar longtext etcAnd I want to keep the default value if its not 'none'
am new here so please redirect me if am posting this wrong sorry i can't post images yet
i have just collided with a problem on merging two primary keys into oneInformation: