I want to get values in column (item_name) and put it to another column(items_ordered) in another table
i tried the basic codes but it doesn't work (the usual insert sql)
tablename:mycart
+------+----------------+
| item_name | Client |
+------+----------------+
| item1 | wev |
| item2 | wev |
| item3 | wev |
+------+----------------+
tablename:orders
+------+--------------------+
| items_ordered | Client |
+------+--------------------+
| | |
+------+--------------------+
what I want it to be is like this:
tablename:orders
+------+--------------------------+
| items_ordered | Client |
+------+--------------------------+
| item1,item2,item3 | wev |
+------+--------------------------+
Code i used:
$sqlb = "select * from mycart where client='" . $_SESSION['fname'] . "'";
$resultb = $conn->query($sqlb);
while($rowb = $resultb->fetch_assoc()){
$rowb['item_name'] . ', ' ;
$client=$rowb['client'];
$sql_insertInto_myCart = "INSERT INTO orders(items,client) VALUES('$rowb','$client')";
$query_sql_insertInto_myCart = $conn->query($sql_insertInto_myCart);
if(isset($query_sql_insertInto_myCart)) {
}
}