Jump to content

blueman378

Members
  • Posts

    888
  • Joined

  • Last visited

    Never

Posts posted by blueman378

  1. Not bad for a first attempt.

     

    Thought #1

     

    add some more colour.

     

    even if it is just a solid black background that spans 100% wide and contains this info(in white text):

    DAVID'S PHOTOGRAPHY

     

    Sydney Australia

     

    ***@***.com

     

    Thought #2

     

    The font is fine for your contact info, and maybe even the footer.

    But i would not suggest using it for your menu.

     

    Thought #3

     

    Shrink the size of the text on your footer.

     

    a footer is meant to be noticeable, but not dominant :)

     

  2. Hi there,

     

    Is it possible to count the number of times a monday appears in a date range,

     

    so eg you pass in 2009-01-01 and 2010-12-31

     

    it should spit out a number which is the number of times monday appears in that range.

     

    also,

    is it possible to have the return value of one column be accessible via a simple variable,

     

    i ask because i have something like:

     

    SELECT
    SUM(
    IF(e.eatin_monday_status,1,
    IF(p.pickup_monday_status,1,
    IF(d.delivery_monday_status,1,0)))+
    
    IF(e.eatin_tuesday_status,1,
    IF(p.pickup_tuesday_status,1,
    IF(d.delivery_tuesday_status,1,0)))+
    
    IF(e.eatin_wednesday_status,1,
    IF(p.pickup_wednesday_status,1,
    IF(d.delivery_wednesday_status,1,0)))+
    
    IF(e.eatin_thursday_status,1,
    IF(p.pickup_thursday_status,1,
    IF(d.delivery_thursday_status,1,0)))+
    
    IF(e.eatin_friday_status,1,
    IF(p.pickup_friday_status,1,
    IF(d.delivery_friday_status,1,0)))+
    
    IF(e.eatin_saturday_status,1,
    IF(p.pickup_saturday_status,1,
    IF(d.delivery_saturday_status,1,0)))+
    
    IF(e.eatin_sunday_status,1,
    IF(p.pickup_sunday_status,1,
    IF(d.delivery_sunday_status,1,0)))) as openweekly
    
    FROM
    location_hours_eatin e
    LEFT JOIN
    location_hours_pickup p
    ON e.eatin_locationid = p.pickup_locationid
    LEFT JOIN
    location_hours_delivery d
    ON e.eatin_locationid = d.delivery_locationid
    WHERE e.eatin_locationid = 6;
    

     

    and dont want to have to repeat that every time i want to use the value, i want to be able to go eg

     

    SELECT
    SET @days_open = SUM(
    IF(e.eatin_monday_status,1,
    IF(p.pickup_monday_status,1,
    IF(d.delivery_monday_status,1,0)))+
    
    IF(e.eatin_tuesday_status,1,
    IF(p.pickup_tuesday_status,1,
    IF(d.delivery_tuesday_status,1,0)))+
    
    IF(e.eatin_wednesday_status,1,
    IF(p.pickup_wednesday_status,1,
    IF(d.delivery_wednesday_status,1,0)))+
    
    IF(e.eatin_thursday_status,1,
    IF(p.pickup_thursday_status,1,
    IF(d.delivery_thursday_status,1,0)))+
    
    IF(e.eatin_friday_status,1,
    IF(p.pickup_friday_status,1,
    IF(d.delivery_friday_status,1,0)))+
    
    IF(e.eatin_saturday_status,1,
    IF(p.pickup_saturday_status,1,
    IF(d.delivery_saturday_status,1,0)))+
    
    IF(e.eatin_sunday_status,1,
    IF(p.pickup_sunday_status,1,
    IF(d.delivery_sunday_status,1,0)))) as openweekly,
    e.eatin_thursday_total/@days_open as thursday_total
    
    FROM
    location_hours_eatin e
    LEFT JOIN
    location_hours_pickup p
    ON e.eatin_locationid = p.pickup_locationid
    LEFT JOIN
    location_hours_delivery d
    ON e.eatin_locationid = d.delivery_locationid
    WHERE e.eatin_locationid = 6;
    

     

    is this possible?

     

  3. ok, im not sure if i should get this topic moved to the sql section or not now,

     

    but im almost there,

     

    my query is

     

    SELECT Week(order_date), Min(order_date), Max(order_date), Sum(order_amount), count(order_amount)
    FROM order_main
    WHERE location_id='6'
    AND order_date BETWEEN '2010-01-01' AND '2010-01-26'
    GROUP BY week(order_date);
    

     

    now the only thing i have left to do is,

    where is has "Min(order_date), Max(order_date)"

     

    i need to wrap them in something like

     

    Monday(Min(order_date)), Sunday(Max(order_date))

     

    ie, i need to get the date of the monday of the week of the date contained in Min(order_date)

    and the sunday for Max(order_date)

     

    are there functions to do this or will i have to do this php side?

  4. Hi PFMaBiSmAd,

     

    Thanks for your reply,

     

    i've been looking into this but im not to quite to sure how i would go about it.

     

    Am i

     

    a) creating the date ranges and grabbing all the data that is between those two dates and summing those,

    then running it on the next seven day period?

     

    eg

     

    
    function groupByWeek($date,$date2)
    {
        $dates = Array();
    
        $date1 = new DateTime($date);
        
        //isBetween is defined somewhere else
        //Start date, End date, Date to check
        while(isBetween($date,$date2,$date)
        {
            $dateTemp = $date->modify('+6 days');
            $range = "$date1."-".$dateTemp";
    
            $query = "SELECT order_amount, SUM(order_amount) FROM order_mian order_date WHERE order_date BETWEEN '$date' AND '$date2'"; 
            $result = mysql_query($query);
    
            $row =  mysql_fetch_array($result);
    
            $dates[$range]['sum'] = $row['SUM(order_amount)'];
            $date1 = $date->modify('+7 days');
        }
    
        return $dates;
    }
    

     

    i dont even know if that will work, but am i doing that,

    or can i do something like

     

    $query = "SELECT order_amount, FROM order_main GROUP BY[ order_date WHERE order_date BETWEEN '$date' AND '$date2']";

     

    the latter would be the best i believe.

  5. Hi there guys,

     

    Well,

    I am givin an array in a format something like below,

     

    my issue is i must sort it in two differnt formats,

     

    one is monday-sunday groupings

     

    the other is simply 7 day groupings

     

    eg from 2009-12-01

    till 2009-12-07

     

    and end up with an array like

    $sales[2009-12-01 2009-12-07][quantity] = 15

    $sales[2009-12-01 2009-12-07][sales] = 2500

     

    $sales[2009-12-01 2009-12-07][quantity] = 15

    $sales[2009-12-01 2009-12-07][sales] = 2500

     

    so for each sales that fits in each group, i must increment quantity by 1, and also add the order_amount to sales.

     

    please set me on the right track and i will work the rest.

     

    regards,

    Matt

     

       (
                [order_date] => 2009-12-01 14:49:49
                [order_amount] => 19.50
            )
    
        [1] => Array
            ( 
                [order_date] => 2009-12-08 15:20:51
                [order_amount] => 16.00
            )
    
        [2] => Array
            (
                [order_date] => 2009-12-08 15:00:48
                [order_amount] => 16.00
            )
    
        [3] => Array
            (
                [order_date] => 2009-12-08 15:32:25
                [order_amount] => 25.75
            )
    
        [4] => Array
            (
                [order_date] => 2009-12-08 15:38:05
                [order_amount] => 23.00
            )
    
    ......................continued.......................
    
        [149] => Array
            (
                [order_date] => 2009-12-21 17:57:37
                [order_amount] => 16.00
            )
    
        [150] => Array
            (
                [order_date] => 2009-12-21 18:00:41
                [order_amount] => 8.00
            )
    
        [151] => Array
            (
                [order_date] => 2009-12-21 18:13:01
                [order_amount] => 16.00
            )
    
        [152] => Array
            (
                [order_date] => 2009-12-21 18:20:49
                [order_amount] => 16.00
            )
    
        [153] => Array
            (
                [order_date] => 2009-12-21 18:43:43
                [order_amount] => 16.00
            )
    
        [154] => Array
            (
                [order_date] => 2009-12-21 19:45:38
                [order_amount] => 53.50
            )
    
        [155] => Array
            (
                [order_date] => 2009-12-22 05:02:53
                [order_amount] => 16.00
            )
    
        [156] => Array
            (
                [order_date] => 2009-12-22 17:51:41
                [order_amount] => 16.00
            )
    
        [157] => Array
            (
                [order_date] => 2009-12-22 18:09:15
                [order_amount] => 16.00
            )
    
        [158] => Array
            (
                [order_date] => 2009-12-22 18:13:03
                [order_amount] => 8.00
            )
    
        [159] => Array
            (
                [order_date] => 2009-12-28 12:12:40
                [order_amount] => 16.00
            )
    
    )
    

  6. Hi guys,

     

    I'm looking to loop over a date range,

     

    eg

    $date = '15/03/1991';
    $date2 = '21/07/2009';
    $array = array();
    while($date <= $date2)
    {
        $array[$date]['value'] = 'somedata';
        $date.adddays(1);
    }
    

     

    obviously i know this is not going to work,

     

    but other than nested loops and constant date checking for days in month/ leap year ect is there any way to do this?

     

    regards,

    Matt

  7. Hi guys,

     

    Is there a simple way to eg

     

    if(18:30 > 07:30)

    echo "correct";

     

    obviously i know this wont work.

     

    but is there a function to do it or will i have to explode it on : and then compare the hours, if they are equal then compare the minutes?

  8. A few things i've noticed

     

    Error Page

    No [back] link. Unless a user navigates backwards they are stuck.

    This is a bad idea

     

    Some errors reference error.html which is working

    however some, such as file not found reference error.php which does not exist.

     

    Resize to

    Im not sure if this is an issue, but

    if i upload say a 100x100 image and tell it to resize to 640x480 as an example then no error message is displayed.

    possibly a

    "The resize scale you have chosen is larger than the image, no resize will occur

    [continue upload] [cancel]"

     

    message will work well?

     

    Edit: Uh oh: After using it it seems to be broken, did i break it?

  9. Hi mate,

    pleased use

    
    

    tags,

     

    while($row = mysql_fetch_array($result)){
       $debit = $row['debit'];
       $credit = $row['credit'];
       $acnum = $row['acnum'];
       $query1 = "SELECT cbal FROM accounts WHERE acnum = '$acnum'";
       $res = mysql_query($query1);
       $balancenum=mysql_num_rows($res);
       while($row1 = mysql_fetch_array($res)){
          $cbal = $row1['cbal'];
       }
       If (is_numeric($debit)){
          $actype = substr($acnum,0,1);
          settype($actype, "integer");
          echo $actype;
          echo "<br>";
          echo gettype($actype);
          echo "<br>";
          If ($actype == 1 || $actype == 5 || $actype == 6 || $actype == {
             $cbal = $cbal - $debit;
             $sql2="UPDATE accounts SET cbal = '$cbal' WHERE acnum = '$acnum'";
             echo "2" . $sql2;
             echo "<br>";
             mysql_query($sql2);
          } else {
             $cbal = $cbal + $debit;
             $sql2="UPDATE accounts SET cbal = '$cbal' WHERE acnum = '$acnum'";
             echo "2". $sql2;
                      echo "<br>";
             mysql_query($sql2);
          }
       }
       If (is_numeric($credit)){
          $actype = substr($acnum,0,1);
          settype($actype, "integer");
          echo $actype;
          echo "<br>";
          echo gettype($actype);
          echo "<br>";
          If ($actype == 1 || $actype == 5 || $actype == 6 || $actype == {
             $cbal = $cbal + $credit;
             $sql="UPDATE accounts SET cbal = '$cbal' WHERE acnum = '$acnum'";
             echo $sql;
             echo "<br>";
             mysql_query($sql);
          } else {
             $cbal = $cbal - $credit;
             $sql="UPDATE accounts SET cbal = '$cbal' WHERE acnum = '$acnum'";
             echo $sql;
                      echo "<br>";
             mysql_query($sql);
          }
       }
    }
    

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