Jump to content

ipwnzphp

Members
  • Posts

    129
  • Joined

  • Last visited

    Never

Posts posted by ipwnzphp

  1. I have this script i am coding and it just repeats the checkboxes over and over... i need it to only show the checkboxes for each amentie once and show checked if it is in the database...

     

     

       <? 
    
        $result = mysql_query("SELECT * FROM amenties ORDER BY id DESC");
    while ($row = mysql_fetch_array($result)) {
    
    foreach ($explode_amen as $aman) {
    
    if($aman == $row['id']) {
    $picked = "checked";
    } else {
    $picked = "";
    }	 
    
    ?>
        
        <div style="float:left; width:210px;"><input name="amen[]" type="checkbox" id="amen[]" style="width:25px;" value="<?=$row['id']?>" <?=$picked?> /><?=$row['amen_name']?></div>
       
        <? 
     } 
     }
    ?>

  2. $query='SELECT * FROM table1 LEFT JOIN table2 ON table1.somefield=table2.somefield WHERE table1.somefield=\'value\' ';

    $result=mysql_query($query) or die(mysql_error());

    if(mysql_num_rows($result)>0){

      while($row=mysql_fetch_assoc($result)){

        $table[]=$row;

      }

    }

    print_r($table);

     

    would this be what you want? =o

    the somefield doesn't need to have the same fieldname in both tables

     

    Still dont understand how to sort it out though into tables of level 1, level 2 and so on until level 5.

  3. Let me be more clear..

     

    LEVEL 1
    $level_one = mysql_query("select * from users where ref_by = '$username'");
    while ($level_one_do = mysql_fetch_array($level_one)) {
    $level_one_do['Username'];
    
    LEVEL 2
    $level_one = mysql_query("select * from users where username = '$level_one_do[username]'");
    while ($level_one_do = mysql_fetch_array($level_one)) {
    $level_one_do['Username'];
    }
    }

     

    Just some rough code..

     

  4. I have a while loop that is making a table 5 times for me. The issue that i am having is i need to run 5 different mysql query's for the 5 different tables that the loop is making for me. How would i go about doing this?

     

    Here is my code

     

    <?
    
    $i=1;
    
    while ( $i <= 5 ) {
    
    ?>
    <table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="414" height="35" colspan="5"><strong>Level <?=$i?></strong></td>
      </tr>
      <tr>
        <td height="25"><div align="center">Join Date</div></td>
        <td><div align="center">Member Name</div></td>
        <td><div align="center">Username</div></td>
        <td><div align="center">Free/Pro</div></td>
        <td><div align="center"></div></td>
      </tr>
      
      <? 
       
      $level_one = mysql_query("select * from users where ref_by = '$username'");
      while ($level_one_do = mysql_fetch_array($level_one)) {
      
      $status = $level_one_do['status'];
      
      if($status == 1) {
      $status_type = "Free";
      } else {
      $status_type = "Pro";
      }
      ?>
      
      <tr>
        <td height="35"><div align="center"></div></td>
        <td height="35"><div align="center"></div></td>
        <td height="35"><div align="center">
          <?=$level_one_do['Username']?>
        </div></td>
        <td height="35"><div align="center"></div></td>
        <td height="35"><div align="center"><img src="images/email_forward-32.png" width="25" height="25"></div></td>
      </tr> <? } ?>
    </table>
    <? $i++;  } ?>

     

     

     

  5. I have a app that i am working on and it has got me a lil fired up this am!! lol. here is what i am trying to do.

     

    My Issue

    I am trying to get the total number of hours worked form the db by adding the start_time and the end_time together.

     

    My Code Snippet

    <?
    $results = mysql_query("SELECT * FROM `simp_time_logger` WHERE p_id = '$id'") or die (mysql_error());
    while ($rows = mysql_fetch_array($results)) {
    $explode_time = explode(" ", $rows['start_time']);
    $explode_time2 = explode(" ", $rows['end_time']);
    $start =  $explode_time[0];
    $end =  $explode_time2[0];
    $time = $start + $end;
    }
    echo $time;
    ?>

     

    My Error

    Says the number of hours worked is 16, How can this be when the start time is 8:29:55 and the end time is 8:29:57

     

    Now the time is stored in the db like this 8:29:55 AM i am using explode to break off the AM/PM form it. I just need it to read the rows of the table and then get the correct total of hours worked to display.

     

    Any help will be greatly appreciated. Thanks!

  6. This mysql/php data is display twice in the options for the drop down. It should only display the results once and not twice.

     

    <select name="altcaddy2" id="altcaddy2">
      
      {php}
      
         $s_id = session_id();
         
         $checkouts = mysql_query("SELECT * FROM `caddie_checkout_storeage` WHERE checkout_session_id = '$s_id'") or die (mysql_error()); 
         while ($get_checkouts = mysql_fetch_array($checkouts)) {
         
         $date_id = $get_checkouts['date_id'];
      
      $datezs = mysql_query("SELECT * FROM `caddie_schedule` WHERE status='enable' && schedule_id = '$date_id'") or die (mysql_error()); 
      while ($get_datezs = mysql_fetch_array($datezs)) {
      
        $datezss = mysql_query("SELECT DISTINCT member_id FROM `caddie_schedule` WHERE status='enable' && start_date = '$get_datezs[start_date]'") or die (mysql_error()); 
      while ($get_datezss = mysql_fetch_array($datezss)) {
    
      $caddie_atl = mysql_query("SELECT * FROM `member` WHERE status='enable' && member_id = '$get_datezss[member_id]'") or die (mysql_error()); 
      $get_caddie_atl = mysql_fetch_array($caddie_atl);
      
      $caddie_id = $get_caddie_atl['member_id'];
      
      {/php}
      
    
        <option value="{php} echo $caddie_id; {/php}">{php} echo $get_caddie_atl['first_name']; {/php}</option>
    
      {php}
    }
       }
       }
       {/php}
      
      </select>

     

    Example:

        <option value="43">Sooners</option>
    
        
    
        <option value="44">Emerge</option>
    
        
    
        <option value="45">Panita</option>
    
        
    
        <option value="43">Sooners</option>
    
        
    
        <option value="44">Emerge</option>
    
        
    
        <option value="45">Panita</option>
    

     

    Thanks!

  7. i'm guessing it's because your assignment of $regdate is failing. have you checked to see what's in $items_pull?

     

    $duedate = $items_pull['age_in_days'];
    
    echo $duedate."<br><br>";
    

     

    Shows things like

     

    733997

     

    733997

     

    733997

     

    733997

     

    733999

     

    733999

     

    734002

    733997

     

    733997

     

    733997

     

    and $regdate shows the same thing.

     

    733997

     

    733999

     

    733999

     

    734002

     

  8. It sent an email for every service

     

    Here is my code

     

    require("dbconnect.php");
    
    $hosting_get = mysql_query("SELECT TO_DAYS(nextduedate) AS age_in_days_due, userid, id, billingcycle, username FROM `tblhosting` WHERE domainstatus = 'Active'");
    while ($hosting_pull = mysql_fetch_array($hosting_get)) {
    
    $userid = $hosting_pull['userid'];
    
    $orderid = $hosting_pull['id'];
    
    $billingcycle = $hosting_pull['billingcycle'];
    
    $regdate =$hosting_pull['age_in_days_due'];
    
    $username = $hosting_pull['username'];
    
    $items_get = mysql_query("SELECT TO_DAYS(duedate) AS age_in_days FROM `tblinvoiceitems` WHERE relid = '$orderid'");
    $items_pull = mysql_fetch_array($items_get);
    
    $duedate = $items_pull['age_in_days'];
    
    $dodatemath = $regdate - $duedate;
    
    if($dodatemath >= 32) {
    
    $to  = '';
    
    $subject = 'Invoice Aduit Report';
    
    $message = "There is no invoice for ". $username;
    
     @mail($to, $subject, $message);
     }
    
    
    }
    

  9. let's see if i can guide you through this in simple steps:

     

    1. $regdate holds a value, in days, of `nextduedate` from the table `tblhosting`,

    2. once you fix your queries, $duedate will hold a value, in days, of `duedate` from the table `tblinvoiceitems`, and

    3. subtracting one of those variables from the other will give the difference, in days, between the two dates.

     

    based on those facts, how do you think you could check whether the difference between those two dates is 32 days or more?

     

    $dodatemath = $regdate - $duedate;
    if($dodatemath >= 32) {
    // mail functions here
    }
    

     

    That correct?

  10. this section:

     

    $hosting_get = mysql_query("SELECT TO_DAYS(nextduedate) AS age_in_days_due FROM `tblhosting` WHERE domainstatus = 'Active'");
    while ($hosting_pull = mysql_fetch_array($hosting_get)) {
    
    $userid = $hosting_pull['userid'];
    
    $orderid = $hosting_pull['id'];
    
    $billingcycle = $hosting_pull['billingcycle'];
    
    $regdate =$hosting_pull['age_in_days_due'];
    
    $username = $hosting_pull['username'];

     

    is flawed. you're not SELECTing anything other than the `age_in_days_due` column, so `userid`, `id`, `billingcycle` and `username` won't be defined. that causes the second query to grab nothing, since $orderid is not defined. add those other columns to the SELECT query.

     

    second, this condition:

     

       if($duedate >= $regdate) {

     

    just checks if the $duedate is greater than or equal than $regdate, with no mention of your 32-day delay.

     

    How would i do the 32 day delay?

  11. Still not working, here is my updated code.

     

    require("dbconnect.php");
    
    $hosting_get = mysql_query("SELECT TO_DAYS(nextduedate) AS age_in_days_due FROM `tblhosting` WHERE domainstatus = 'Active'");
    while ($hosting_pull = mysql_fetch_array($hosting_get)) {
    
    $userid = $hosting_pull['userid'];
    
    $orderid = $hosting_pull['id'];
    
    $billingcycle = $hosting_pull['billingcycle'];
    
    $regdate =$hosting_pull['age_in_days_due'];
    
    $username = $hosting_pull['username'];
    
    $items_get = mysql_query("SELECT TO_DAYS(duedate) AS age_in_days FROM `tblinvoiceitems` WHERE relid = '$orderid'");
    $items_pull = mysql_fetch_array($items_get);
    
    $duedate = $items_pull['age_in_days'];
    
    if($billingcycle == "Monthly"){	
    
    if($duedate >= $regdate) {
    
    $to  = '';
    
    $subject = 'Invoice Aduit Report';
    
    $message = "There is no invoice for ". $username;
    
     @mail($to, $subject, $message;
     }
    
    
        }
    
    }
    

  12. Here is my full code, it is still not working.

     

    
    require("dbconnect.php");
    
    $hosting_get = mysql_query("SELECT (TO_DAYS(NOW()) - TO_DAYS(nextduedate)) AS age_in_days_due FROM `tblhosting` WHERE domainstatus = 'Active'");
    while ($hosting_pull = mysql_fetch_array($hosting_get)) {
    
    $userid = $hosting_pull['userid'];
    
    $orderid = $hosting_pull['id'];
    
    $billingcycle = $hosting_pull['billingcycle'];
    
    $regdate =$hosting_pull['age_in_days_due'];
    
    $username = $hosting_pull['username'];
    
    $items_get = mysql_query("SELECT (TO_DAYS(NOW()) - TO_DAYS(duedate)) AS age_in_days  FROM `tblinvoiceitems` WHERE relid = '$orderid'");
    $items_pull = mysql_fetch_array($items_get);
    
    $duedate = $items_pull['age_in_days'];
    
    
    if($billingcycle == "Monthly"){	
    
    if($duedate >= $regdate) {
    
    $to  = '';
    
    $subject = 'Invoice Aduit Report';
    
    $message = "There is no invoice for ". $username;
    
     @mail($to, $subject, $message);
     }
    
    
        }
    
    }
    
    

  13. Here is my due date: 2009-08-19

    Here is my next due date: 2010-08-18

     

    My dates are stored in same format i posted the dates as.

     

    What it should do, If time between the last invoice and the next due date is greater than or equal to. It should email me!

     

    
    $datedff = ""; what goes here?
    
    if($datedff >= "32") {
    
    $to  = '';
    
    $subject = 'Invoice Aduit Report';
    
    $message = "There is no invoice for ". $username;
    
     @mail($to, $subject, $message, $headers);
     }
    
    

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