Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It's more or less right - just 2 lines need to be changed.</p> <ol> <li>There's no need for the extra array() around array_unshift and array_pop.</li> <li>When you use array_unshift you're pushing an array of items (not the id/codes individually) - I think you mean <code>array_unshift($RView, array($prodid,$name,...))</code></li> <li>What if $RView doesn't have 5 elements? In that case you're accessing undefined array indices (which may or may not show an error). Change it to a foreach loop: e.g.<br> <code>foreach ($Rview as $prod) echo $prod['Name']...</code></li> </ol> <p>It should work after you make these changes. You might want to clean up the coding style a bit, though :)</p> <hr> <p>EDIT: Oh, I see, when you're referencing the array in the for loop it doesn't know that the array has "ProdID" and "Name" indices. When you make an array you have to define the indexes using the => operator.</p> <ul> <li><p>Add indexes to the array when you array_unshift:<br> <code>array_unshift($RView, array("ProdID" =&gt; $row_rsProd["ProdID"], "Name"...))</code> </p></li> <li><p>If row_rsProd isn't too big, you can just tack the entire row_rsprod onto $RView.<br> so change array_unshift(...) to just <code>$RView[] = $row_rsProd</code><br> This way the indexes are preserved.</p></li> <li>Alternatively you can change the indicies in the for loop to match. Right now the array you unshift onto $RView is 0-based - $RView[0][0] is the product ID for the first product, etc.<br> So you can change the stuff in the foreach loop to<br> <code>echo "&lt;li&gt;..." $prod[0] $prod[1] $prod[2]</code></li> </ul> <p>Hope that helps!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload