Pleas see it: (oid, iid, name, type) VALUES (5, X3, john, boxer) I want to insert oid. It is from a different table $oid=mysql_fetch_array['oid']; where iid name and type is same. Can i insert thes at only one statement
An INSERT query may have many sets of values:
INSERT INTO table (oid, iid, name, type) VALUES (5, 'X3', 'john', 'boxer'), (8, 'X3', 'john', 'boxer'), (10, 'X3', 'john', 'boxer')...
http://dev.mysql.com/doc/refman/5.5/en/insert.html
You will need to specify all values for all columns you wish to insert even if they are the same in multiple rows.
$query = "INSERT INTO your_table
(oid, iid, name, type)
VALUES
(5, 'X3', 'john', 'boxer'),
(8, 'X3', 'john', 'boxer'),
(10, 'X3', 'john', 'boxer'),
(11, 'X3', 'john', 'boxer'),
(60, 'X3', 'john', 'boxer'),
(220, 'X3', 'john', 'boxer'),
(311, 'X3', 'john', 'boxer'),
(336, 'X3', 'john', 'boxer'),
(339, 'X3', 'john', 'boxer'),
(800, 'X3', 'john', 'boxer');";
$result = mysql_query($query);