
Originally Posted by
monkey56657
Can u provide a short snippet with what the output shud be like...Im not exactly sure what you are aiming to do
This is for a php project i am doing for a course - therefore i can't use someone elses code - aganst the rules.
Having said that, i have been here for hours trying to work this out - so if you can pass me onto any websites which may help (tutorials) or point me in the right direction i would appreciated it.
The code i created is below,
PHP Code:
<?php
$terminator_bid ="10";
$terminator = "$terminator_bid";
$alien = "3";
$batman = "22";
$ads = array (
"ad_positions" => array ( "Terminator" => "$terminator", "Alien" => "$alien", "Batman" => "$batman"),
"positions" => array ( "1", "2", "3" )
);
/* asort - assending by values (numbers, ect)*/
arsort($ads[ad_positions]);
/* arsort - desecnding by values (numbers, ect)*/
echo "<table border='1' cellpadding='7'>";
echo "<tr><th>Position</th><th>DVD Name</th><th>Bid Price</th></tr>";
foreach ($ads[positions] as $rank)
foreach ($ads[ad_positions] as $list => $price)
{
echo "<tr><td>$rank</td><td>$list</td><td>$price</td></tr>";
}
echo "</table>";
?>
At the moment everything repeats 3 times - i guess the array is being looped or something.
It should only contain the first 3 positions.
Positions 1, 2, 3 with DVD name as Batman, Alien & Terminator plus 3 seperate bid prices.
As you may see it repeats...
Bookmarks