I use the top table as a cart for 1 customer, and the bottom table for order.

I wanted to get the productprice, productname, productqty and put it into orderdetail field.

Help and suggestions are very much appreciated.

Thanks in advance.

*attached a pic of the tables.

assuming the field will be a valid type, you can query the first table for those fields, and then insert them into the second table. in php

$res = mysql_query("select productprice, productname, productqty from table_name where id='" . $target . "' limit 1;") or die(mysql_error());
if(mysql_num_rows($res) == 1) {
   $row = mysql_fetch_array($res);
   $insert = $row['productprice'] . $row['productname'] . $row['productqty'];
   $sql = mysql_query("insert into table_name values('', 'name', '" . $insert . "', 'amount');") or die(mysql_error());
}

You'd probably want/need to format $insert before inserting it. If you're using something like phpadmin, then I *think* you'd just use the sql syntax in a query box; It's been a while since I've coded any of this type stuff, but hopefully it's along those lines.

HTH

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.