PHP i want to use foreach function for 3 variables i use this code in my page: $quantity){ $query = "INSERT INTO order_detail (commodity_id,quantity,c_stander_name,order_id) VALUES ('$commodity_id','$quantity','$c_stander_name','$order_id')"; $result = execute_sql($link, "0201", $query); } ?> how can i do that like : $quantity =>$c_stander_name){ $query = "INSERT INTO order_detail (commodity_id,quantity,c_stander_name,order_id) VALUES ('$commodity_id','$quantity','$c_stander_name','$order_id')"; $result = execute_sql($link, "0201", $query); } ?>    No hand written and fast answer with explanation

Np Ms Office 365/Excel 2016 I Ntermed
1st Edition
ISBN:9781337508841
Author:Carey
Publisher:Carey
Chapter3: Performing Calculations With Formulas And Functions
Section: Chapter Questions
Problem 3.9CP
icon
Related questions
Question

PHP

i want to use foreach function for 3 variables

i use this code in my page:

<?php foreach(array_combine($commodity_id, $quantity) as $commodity_id => $quantity){ $query = "INSERT INTO order_detail (commodity_id,quantity,c_stander_name,order_id) VALUES ('$commodity_id','$quantity','$c_stander_name','$order_id')"; $result = execute_sql($link, "0201", $query); } ?>

how can i do that like :

<?php foreach(array_combine($commodity_id, $quantity,$c_stander_name) as $commodity_id => $quantity =>$c_stander_name){ $query = "INSERT INTO order_detail (commodity_id,quantity,c_stander_name,order_id) VALUES ('$commodity_id','$quantity','$c_stander_name','$order_id')"; $result = execute_sql($link, "0201", $query); } ?> 

 

No hand written and fast answer with explanation 

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
SQL Functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr