I've just about given up trying to understand these arrays. I've searched and read tutorials and am getting headaches
If anyone has some advice I basically have this:
Code: Select all
//get the transactions that are of type 'stock' and that are within the date range and stick them in an array
//===========================================================================
mysql_select_db($dbname);
$sql = "SELECT * FROM transactions WHERE type = 'stock' && date <= '$end_date' && date >= '$start_date' ORDER BY id ASC";
$content = mysql_query($sql);
$Xcontent = mysql_fetch_array($content);
$ShowMax = mysql_num_rows($content);
for ($y=1; $y<=$ShowMax; $y++)
{
//Get the info from the database and smack it in variables for user later
$transaction_id = $Xcontent["id"];
$transaction_type_id = $Xcontent["type_id"];
$transaction_price = $Xcontent["price"];
//now stick this stuff into an array
$trans_multi_array = array("$transaction_id", "$transaction_type_id", "$transaction_price");
$Xcontent = mysql_fetch_array($content);
}Code: Select all
foreach($trans_multi_array as $transaction_id => $transaction_type_id) {}How can I also access the price part of that array?
Any help REALLY appreciated...
Rob