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]
Link to comment
Share on other sites

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.