SitePoint Sponsor

User Tag List

Results 1 to 14 of 14
  1. #1
    SitePoint Enthusiast baddot's Avatar
    Join Date
    Nov 2006
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Getting A variable out of a variable ?

    hi guys i need help on my script i tried alot of ways but i just could not get the variable out of the variable. eg i want to put $date and $date2 as i can calculate each date in like

    eg distinct(calldate),sum(peak) from call_ds in mysql syntax i cant do the distinct because i have manymore data i have to pull out

    hope you guys can help =)

    PHP Code:
       $query "SELECT callDate, peak, offPeak callerId FROM call_ds";
      
    $peakprice 1.95;
      
    $offpeakprice 0.98;
      
    $exec mysql_query($query);
      
    $date2 "";
      while(
    $r=mysql_fetch_row($exec))
      {
      
    $rPeak $r[1];
      
    $rOffPeak $r[2];
      
    $callid $r[3];
      
    $date $r[0];
      
    $mydate $date;
      if(
    $mydate != $date2){
      
    $date2 $mydate//try to draw out date as i can get the if and else below so that i cant have individual date like distinct function
      
    $mydate "";
      echo 
    $date2 " set as " $mydate;
      }
      
      if (
    $date2 == $date){
      echo 
    $date " " $date2 "<br>";  // testing echos
      
    echo $rPeak "<br>"// testing echos
      
    $tmpd += $rPeak;
      echo 
    $tmpd "<br>"// testing echos
      
    } else {
    // this will be the table which will be shown
      
    $tmpd $tmpd/60;
      
    $tmpd number_format(($tmpd*$peakprice),2);
       echo 
    "<tr>"
       echo 
    "<td align='center' valign='top'>$date</td>";
       echo 
    "<td align='center' valign='top'>$tmpd</td>"//total revenue per day which calculated on top on the if date2 = date
       
    echo "<td align='center' valign='top'>$celcom</td>"//celcom
       
    echo "<td align='center' valign='top'>$digi</td>"//digi
       
    echo "<td align='center' valign='top'>$maxis</td>"//maxis
       
    echo "<td align='center' valign='top'>$callid</td>";
       echo 
    "<td align='center' valign='top'>&nbsp;</td>";
       echo 
    "<td align='center' valign='top'>&nbsp;</td>";
       echo 
    "<td align='center' valign='top'>&nbsp;</td>";
       echo 
    "<td align='center' valign='top'>&nbsp;</td>";
       echo 
    "<td align='center' valign='top'>&nbsp;</td>";
       echo 
    "<td align='center' valign='top'>&nbsp;</td>";
       echo 
    "<td align='center' valign='top'>&nbsp;</td>";
       echo 
    "</tr>";
      }
      
       
    $MrPeak "";
       
    $CrPeak "";
       
    $tm "";
       
    $maxis "";
       
    $celcom "";
       
    $digi "";
       
    $rPeak "";
       
    $mydate "";
     } 
    Make Friends And Earn Money @ Zonity.com
    Make Money at BadDot.com

  2. #2
    SitePoint Evangelist
    Join Date
    Apr 2005
    Location
    London, UK
    Posts
    505
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To get the type or name of another variable see the use of $variable, $variable.


    HTH

  3. #3
    SitePoint Enthusiast baddot's Avatar
    Join Date
    Nov 2006
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ma201dq
    To get the type or name of another variable see the use of $variable, $variable.


    HTH
    huh ? what do you mean by that $variable,variable ?
    Make Friends And Earn Money @ Zonity.com
    Make Money at BadDot.com

  4. #4
    SitePoint Evangelist
    Join Date
    Apr 2005
    Location
    London, UK
    Posts
    505
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A variable, variable allows one to change/set, then get the type and name of a variable. For example: $variable = ‘meetquanity’; we can use $$variable instead of $meetquanity like this: $$variable = 5; this now is equivalent to $meetquantity = 5;

    HTH

  5. #5
    SitePoint Enthusiast baddot's Avatar
    Join Date
    Nov 2006
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmm any sample ?
    Make Friends And Earn Money @ Zonity.com
    Make Money at BadDot.com

  6. #6
    SitePoint Wizard cranial-bore's Avatar
    Join Date
    Jan 2002
    Location
    Australia
    Posts
    2,634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    variable variable just means you can determine the NAME of one variable by the VALUE of another.
    Example:
    PHP Code:
    $myName 'mike';

    $otherVar 'myName';

    echo $
    $otherVar//Outputs mike 
    The VALUE of $otherVar corresponds to the name of the first variable.
    mikehealy.com.au
    diigital.com art, design . Latest WorkSaturday Morning

  7. #7
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hm is this what you want?
    theres a few different ways to do this, im not crystal clear on exactly what you really want.

    PHP Code:
    $distinct_dates = array();
    while (
    $r mysql_fetch_assoc($result)) {
        if (!isset(
    $distinct_dates[$r['callDate']])) {
            
    $distinct_dates[$r['callDate']] = $r;
        } else {
            
    $distinct_dates[$r['callDate']]['peak'] += $r['peak'];
        }
    }


    /* now you can loop through $distinct_dates 
    and show 1 <tr> for each date, and the peak 
    field will be summed within each date eg
    */
    foreach ($distinct_dates as $date => $associated_values) {
        echo 
    $date;
        
    print_r($associated_values);

    if your trying to do what i think you were, a variation of your existing code could have worked if you buffered the entire row 1 result behind, and used 'continue' to skip outputting the <tr> until the next date wasnt the same. of course, that would also have required that you 'order by callDate' in your sql query.

  8. #8
    SitePoint Enthusiast baddot's Avatar
    Join Date
    Nov 2006
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i just remake the script as into another version but the codes are long take a look here anyway to make it shorter ?

    PHP Code:
      $peakprice 1.95;
      
    $offpeakprice 0.98;
      
    $connect mysql_connect("localhost","mydb","haha");
      
    $qdb mysql_select_db("nahz"$connect) or die("cannot select database");
    $datetocalc 31;
    function 
    get_TMpeak($number){
    // PEAK TM
    $month date('m');
    $year date('Y');
    switch (
    $number) {
    case 
    1:
       
    $number "01";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    2:
       
    $number "02";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    3:
       
    $number "03";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    4:
       
    $number "04";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    5:
       
    $number "05";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    6:
       
    $number "06";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    7:
       
    $number "07";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    8:
       
    $number "08";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    9:
       
    $number "09";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    10:
       
    $number "10";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    11:
       
    $number "11";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    12:
       
    $number "12";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    13:
       
    $number "13";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    14:
       
    $number "14";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    15:
       
    $number "15";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    16:
       
    $number "16";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    17:
       
    $number "17";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    18:
       
    $number "18";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    19:
       
    $number "19";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    20:
       
    $number "20";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    21:
       
    $number "21";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    22:
       
    $number "22";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    23:
       
    $number "23";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    24:
       
    $number "24";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    25:
       
    $number "25";
       
    $thedate $year "-" $month "-" $number;
       break; 
    case 
    26:
       
    $number "26";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    27:
       
    $number "27";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    28:
       
    $number "28";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    29:
       
    $number "29";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    30:
       
    $number "30";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    31:
       
    $number "31";
       
    $thedate $year "-" $month "-" $number;
       break;
     }

    $query "SELECT DISTINCT(callDate),SUM(peak) FROM call_ds WHERE callDate='$thedate' AND callerId = '1120' GROUP BY callDate";  //TM
    $doquery mysql_query($query);
    while(
    $r=mysql_fetch_row($doquery)){
     
    $sumpeak $r[1];
    }
    return 
    $sumpeak;
    }
    function 
    get_DIGIpeak($number){
    //PEAK DIGI
    $month date('m');
    $year date('Y');
    switch (
    $number) {
    case 
    1:
       
    $number "01";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    2:
       
    $number "02";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    3:
       
    $number "03";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    4:
       
    $number "04";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    5:
       
    $number "05";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    6:
       
    $number "06";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    7:
       
    $number "07";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    8:
       
    $number "08";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    9:
       
    $number "09";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    10:
       
    $number "10";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    11:
       
    $number "11";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    12:
       
    $number "12";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    13:
       
    $number "13";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    14:
       
    $number "14";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    15:
       
    $number "15";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    16:
       
    $number "16";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    17:
       
    $number "17";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    18:
       
    $number "18";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    19:
       
    $number "19";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    20:
       
    $number "20";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    21:
       
    $number "21";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    22:
       
    $number "22";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    23:
       
    $number "23";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    24:
       
    $number "24";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    25:
       
    $number "25";
       
    $thedate $year "-" $month "-" $number;
       break; 
    case 
    26:
       
    $number "26";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    27:
       
    $number "27";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    28:
       
    $number "28";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    29:
       
    $number "29";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    30:
       
    $number "30";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    31:
       
    $number "31";
       
    $thedate $year "-" $month "-" $number;
       break;
     }

    $query "SELECT DISTINCT(callDate),SUM(peak) FROM call_ds WHERE callDate='$thedate' AND callerId = '016' GROUP BY callDate";  //DIGI
    $doquery mysql_query($query);
    while(
    $r=mysql_fetch_row($doquery)){
     
    $sumpeak $r[1];
    }
    return 
    $sumpeak;
    }
    function 
    get_CELCOMpeak($number){
    //PEAK CELCOM
    $month date('m');
    $year date('Y');
    switch (
    $number) {
    case 
    1:
       
    $number "01";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    2:
       
    $number "02";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    3:
       
    $number "03";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    4:
       
    $number "04";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    5:
       
    $number "05";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    6:
       
    $number "06";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    7:
       
    $number "07";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    8:
       
    $number "08";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    9:
       
    $number "09";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    10:
       
    $number "10";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    11:
       
    $number "11";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    12:
       
    $number "12";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    13:
       
    $number "13";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    14:
       
    $number "14";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    15:
       
    $number "15";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    16:
       
    $number "16";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    17:
       
    $number "17";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    18:
       
    $number "18";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    19:
       
    $number "19";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    20:
       
    $number "20";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    21:
       
    $number "21";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    22:
       
    $number "22";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    23:
       
    $number "23";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    24:
       
    $number "24";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    25:
       
    $number "25";
       
    $thedate $year "-" $month "-" $number;
       break; 
    case 
    26:
       
    $number "26";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    27:
       
    $number "27";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    28:
       
    $number "28";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    29:
       
    $number "29";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    30:
       
    $number "30";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    31:
       
    $number "31";
       
    $thedate $year "-" $month "-" $number;
       break;
     }
    //echo $query; 
    $query "SELECT DISTINCT(callDate),SUM(peak) FROM call_ds WHERE callDate='$thedate' AND (callerId = '016' OR callerId = '019') GROUP BY callDate";  //CELCOM
    $doquery mysql_query($query);
    while(
    $r=mysql_fetch_row($doquery)){
     
    $sumpeak $r[1];
    }
    return 
    $sumpeak;
    }
    function 
    get_MAXISpeak($number){
    //PEAK CELCOM
    $month date('m');
    $year date('Y');
    switch (
    $number) {
    case 
    1:
       
    $number "01";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    2:
       
    $number "02";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    3:
       
    $number "03";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    4:
       
    $number "04";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    5:
       
    $number "05";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    6:
       
    $number "06";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    7:
       
    $number "07";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    8:
       
    $number "08";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    9:
       
    $number "09";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    10:
       
    $number "10";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    11:
       
    $number "11";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    12:
       
    $number "12";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    13:
       
    $number "13";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    14:
       
    $number "14";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    15:
       
    $number "15";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    16:
       
    $number "16";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    17:
       
    $number "17";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    18:
       
    $number "18";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    19:
       
    $number "19";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    20:
       
    $number "20";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    21:
       
    $number "21";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    22:
       
    $number "22";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    23:
       
    $number "23";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    24:
       
    $number "24";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    25:
       
    $number "25";
       
    $thedate $year "-" $month "-" $number;
       break; 
    case 
    26:
       
    $number "26";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    27:
       
    $number "27";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    28:
       
    $number "28";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    29:
       
    $number "29";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    30:
       
    $number "30";
       
    $thedate $year "-" $month "-" $number;
       break;
    case 
    31:
       
    $number "31";
       
    $thedate $year "-" $month "-" $number;
       break;
     }
    //echo $query; 
    $query "SELECT DISTINCT(callDate),SUM(peak) FROM call_ds WHERE callDate='$thedate' AND (callerId = '012' OR callerId = '017') GROUP BY callDate";  //CELCOM
    $doquery mysql_query($query);
    while(
    $r=mysql_fetch_row($doquery)){
     
    $sumpeak $r[1];
    }
    return 
    $sumpeak;
    }

    function 
    get_date($number){
    $month date('m');
    $year date('Y');
     switch (
    $number) {
    case 
    1:
       
    $number "01";
       break;
    case 
    2:
       
    $number "02";
       break;
    case 
    3:
       
    $number "03";
       break;
    case 
    4:
       
    $number "04";
       break;
    case 
    5:
       
    $number "05";
       break;
    case 
    6:
       
    $number "06";
       break;
    case 
    7:
       
    $number "07";
       break;
    case 
    8:
       
    $number "08";
       break;
    case 
    9:
       
    $number "09";
       break;
    case 
    10:
       
    $number "10";
       break;
    case 
    11:
       
    $number "11";
       break;
    case 
    12:
       
    $number "12";
       break;
    case 
    13:
       
    $number "13";
       break;
    case 
    14:
       
    $number "14";
       break;
    case 
    15:
       
    $number "15";
       break;
    case 
    16:
       
    $number "16";
       break;
    case 
    17:
       
    $number "17";
       break;
    case 
    18:
       
    $number "18";
       break;
    case 
    19:
       
    $number "19";
       break;
    case 
    20:
       
    $number "20";
       break;
    case 
    21:
       
    $number "21";
       break;
    case 
    22:
       
    $number "22";
       break;
    case 
    23:
       
    $number "23";
       break;
    case 
    24:
       
    $number "24";
       break;
    case 
    25:
       
    $number "25";
       break; 
    case 
    26:
       
    $number "26";
       break;
    case 
    27:
       
    $number "27";
       break;
    case 
    28:
       
    $number "28";
       break;
    case 
    29:
       
    $number "29";
       break;
    case 
    30:
       
    $number "30";
       break;
    case 
    31:
       
    $number "31";
       break;
     }
     return 
    $year "-" $month "-" $number;
    }
    for(
    $x=1$x<=$datetocalc$x++){
      
    $thedateis get_date($x);
      
    $peakmins get_TMpeak($x);
      
    $peakmins $peakmins/60;
      
    $peakmins number_format(($peakmins*$peakprice),2);
      
    $peaktotal += $peakmins;
      
    $peakdigi get_DIGIpeak($x);
      
    $peakdigi $peakdigi/60;
      
    $peakdigi number_format(($peakdigi*$peakprice),2);
      
    $digitotal += $peakdigi;
      
    $peakcelcom get_CELCOMpeak($x);
      
    $peakcelcom $peakcelcom/60;
      
    $peakcelcom number_format(($peakcelcom*$peakprice),2);
      
    $celcomtotal += $peakcelcom;
      
    $peakmaxis get_MAXISpeak($x);
      
    $peakmaxis $peakmaxis/60;
      
    $peakmaxis number_format(($peakmaxis*$peakprice),2);
      
    $maxistotal += $peakmaxis;
      
      if(!
    $peakmins){
      
    $peakmins 0;
      }
      
      if(!
    $peakdigi){
      
    $peakdigi 0;
      }
      
      if(!
    $peakmaxis){
      
    $peakmaxis 0;
      }
      
      if(!
    $peakcelcom){
      
    $peakcelcom 0;
      }
       echo 
    "<tr>"
       echo 
    "<td align='center' valign='top'>$thedateis</td>";
       echo 
    "<td align='center' valign='top'>$" $peakmins "</td>"//tm
       
    echo "<td align='center' valign='top'>$" $peakcelcom "</td>"//celcom
       
    echo "<td align='center' valign='top'>$" $peakdigi "</td>"//digi
       
    echo "<td align='center' valign='top'>$" $peakmaxis "</td>"//maxis
       
    echo "<td align='center' valign='top'>$callid</td>";
       echo 
    "<td align='center' valign='top'>&nbsp;</td>";
       echo 
    "<td align='center' valign='top'>&nbsp;</td>";
       echo 
    "<td align='center' valign='top'>&nbsp;</td>";
       echo 
    "<td align='center' valign='top'>&nbsp;</td>";
       echo 
    "<td align='center' valign='top'>&nbsp;</td>";
       echo 
    "<td align='center' valign='top'>&nbsp;</td>";
       echo 
    "<td align='center' valign='top'>&nbsp;</td>";
       echo 
    "</tr>";
    }
      
       echo 
    "<tr>"
       echo 
    "<td align='center' valign='top'>Total Revenue</td>";
       echo 
    "<td align='center' valign='top'>$" $peaktotal "</td>"//tm
       
    echo "<td align='center' valign='top'>$" $celcomtotal "</td>"//celcom
       
    echo "<td align='center' valign='top'>$" $digitotal "</td>"//digi
       
    echo "<td align='center' valign='top'>$" $maxistotal "</td>"//maxis
       
    echo "<td align='center' valign='top'>$callid</td>";
       echo 
    "<td align='center' valign='top'>&nbsp;</td>";
       echo 
    "<td align='center' valign='top'>&nbsp;</td>";
       echo 
    "<td align='center' valign='top'>&nbsp;</td>";
       echo 
    "<td align='center' valign='top'>&nbsp;</td>";
       echo 
    "<td align='center' valign='top'>&nbsp;</td>";
       echo 
    "<td align='center' valign='top'>&nbsp;</td>";
       echo 
    "<td align='center' valign='top'>&nbsp;</td>";
       echo 
    "</tr>"
    Make Friends And Earn Money @ Zonity.com
    Make Money at BadDot.com

  9. #9
    SitePoint Enthusiast baddot's Avatar
    Join Date
    Nov 2006
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the full path will be like this i cant distinct it with just date because i need to deal with each callerid which means each callerid will be related to different telcos...as i just wanted to create a more simpler code which will not take high load of the database to the website on my first post on top but i just could not make it
    Make Friends And Earn Money @ Zonity.com
    Make Money at BadDot.com

  10. #10
    SitePoint Enthusiast
    Join Date
    Jun 2004
    Location
    London
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi baddot,

    This might help.

    http://uk.php.net/language.variables.variable





    .
    David Stevens, create-inspire
    PHP London, www.phplondon.org

  11. #11
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you should see str_pad() if you need to pad a 0 to a string.

  12. #12
    SitePoint Enthusiast baddot's Avatar
    Join Date
    Nov 2006
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    erm.. ur talking about which script now ? im totally lost lol
    Make Friends And Earn Money @ Zonity.com
    Make Money at BadDot.com

  13. #13
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    instead of your many enormous switch statements to add a leading 0 to numbers less than 10
    PHP Code:
    function foo($number) {
        return 
    date('Y-m-') . str_pad($number2STR_PAD_LEFT);


  14. #14
    SitePoint Enthusiast baddot's Avatar
    Join Date
    Nov 2006
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i mean the script can be shorten besides that ?
    Make Friends And Earn Money @ Zonity.com
    Make Money at BadDot.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •