PHP LOOP from database and save into one field

I need some help.

I have table one with field code and table two with field code_two.

record from table_one :

----code----
32
23
34
25
------------

and send to table_two like this

----code_two-----
32,23,34,25.
-----------------

I wanna send record from table one field 'code' into table two field code_two.

Here my php loop input box

foreach($_POST['code'] as $cnt => $qty) {|
    mysql_query("insert into table_two values('$code_from_table_one');
}

is that loop in query is work? i tried and getting error, little help please :( thanks

Answers


Don't need to use PHP for it you can do it with GROUP_CONCAT() in MySQL

INSERT INTO code_two SELECT GROUP_CONCAT(`code` SEPARATOR ',') FROM code

More on http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_group-concat


Need Your Help

CSS affecting nav bar and slider

javascript jquery html css twitter-bootstrap

Basically the problem I am having is that I have some CSS that is affecting both my nav bar and slider, because they are both using and essentially the nav bar is working but the slider is being

Java Screenshot of multiple webpages

java mysql flying-saucer

i'm not going to post any code here because i don't know how to start doing it. Actually I need your help...