php iki diziyi döngü

0 Cevap
$arr1 = array(
    1 => array(
        30 => 100
        31 => 800
    ),
    2 => array(
        30 => 200
        31 => 900
    ),
    3 => array(
        30 => 300
        31 => 100
    ),
    4 => array(
        30 => 400
        31 => 110
    ),
    5 => array(
        30 => 500
        31 => 120
    ),
    6 => array(
        30 => 600
        31 => 130
    ),
    7 => array(
        30 => 260
        31 => 140
    )
);

 

$arr2 = array(
    0 => array(
        id => 30  
    ),
    1 => array(
        id => 31          
    )
)

Ben $ dizi1 döngü gerekir ve bu şekilde eklemek

INSERT INTO tablename (option_value_id,duration_id,price) VALUES ('30','1',100);
INSERT INTO tablename (option_value_id,duration_id,price) VALUES ('30','2',200);
INSERT INTO tablename (option_value_id,duration_id,price) VALUES ('30','3',300);
INSERT INTO tablename (option_value_id,duration_id,price) VALUES ('30','4',300);
INSERT INTO tablename (option_value_id,duration_id,price) VALUES ('30','5',500);

ve benzeri

INSERT INTO tablename (option_value_id,duration_id,price) VALUES ('31','1',900);
INSERT INTO tablename (option_value_id,duration_id,price) VALUES ('31','2',900);
INSERT INTO tablename (option_value_id,duration_id,price) VALUES ('31','3',100);
INSERT INTO tablename (option_value_id,duration_id,price) VALUES ('31','4',110);
INSERT INTO tablename (option_value_id,duration_id,price) VALUES ('31','5',120);    

ve benzerleri. I bu nasıl yapabilirim?

0 Cevap