Jump to content

Can anyone see what i am doing wrong here?


smith.james0

Recommended Posts

That didn't work for me. If I understand what you are trying to do, this might work a little bit better.

[code]<?php
$vCht4 = array();
for ($i = 1; $i <= 52; $i++)
{
    if ($i < 10)
    {
        $temp = "0" . $i;
    }
    else
    {
        $temp = $i;
    }
    $salescum[$i] = $temp;
}
$vCht4 = $salescum;

for ($i = 1; $i < sizeof($salescum); $i++)
{
    ECHO $salescum[$i] . "<br>";
}


?>[/code]
Thanks for the quick reply, that not quite what i am looking for. I have queryed the db

for ($i = 1; $i <= 52; $i++) {

if ($i < 10) {
$i = "0" . $i;
}
$sqlsum = "SELECT SUM(sales) AS sum FROM ******* WHERE week='$i' AND year='2006'";
$resultsales = mysql_query($sqlsum,$db) or die ("Invalid query");
$rowsales = mysql_fetch_assoc($resultsales);
$salescum[$i] = $rowsales['sum'];
}


And i now need to put all 52 results into a array

array($salescum['01'],$salescum['02']...etc...,$salescum['52']);

I need it to insert the results into the array 52 time.

James

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.