Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4565590
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T18:39:54+00:00 2026-05-21T18:39:54+00:00

Array ( [product_id] => Array ( [0] => 61 [1] => 62 [2] =>

  • 0
Array
(
[product_id] => Array
    (
        [0] => 61
        [1] => 62
        [2] => 63
    )

[product_name] => Array
    (
        [0] => 44" jesson WIDESCREEN LCD 
        [1] => 19" jesson WIDESCREEN LCD 
        [2] => Touchscreen monitor
    )

)

I am sort of confused on how to do this simple loop where product_id[0] always matches product_name[0] and so on ….i tried

if i do a foreach i get the first loop is all the product_id and i need the names to be printed also….any ideas

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T18:39:55+00:00Added an answer on May 21, 2026 at 6:39 pm

    For ease of explanation, let’s set:

    $product_id = $myarray['product_id'];
    $product_name = $myarray['product_name'];
    

    As long as you’re sure that $product_id and $product_name have the same keys (and it looks like they do), you can make your loop like this:

    foreach ($product_id as $i => $id) {
      $name = $product_name[$i];
         .
         .
         .
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code $result = $handle->select()->from('store_products_id', array('count'=>'COUNT(store_products_id.product_id)')) ->where('store_products_id.store_id=?', $this->store_id) ->columns($selectColumns) ->join('product_quickinfo', 'store_products_id.product_id
i have this array [Computers] => Array ( [0] => Array ( [product_id] =>
a array like this: a = [<root>, <products>, <product>, <id>, 1, </id>, <name>, name1,
I have this $_POST array coming from a paypal transaction Array ( [address_city] =>
this is the JS <SCRIPT type=text/javascript> $(function() { var ids = new Array(); for(var
How to loop through a SimpleXMLElement object? This is what I have: I tried
I have array which gets from session, this is print_r of array print_r($_SESSION['wpsc_cart']); wpsc_cart
I have a multidimensional array like this : $products Smarty_Variable Object (3) ->value =
I'm trying to update an array element in Java. Some sort of a database
I get data is undefined, i guess i can't ['productId'] in an array, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.