Jump to content

honkmaster

Members
  • Content Count

    35
  • Joined

  • Last visited

Community Reputation

0 Neutral

About honkmaster

  • Rank
    Member

Profile Information

  • Gender
    Not Telling
  1. honkmaster

    Sql to loop through table

    Hi Thank you very much for your response, which is a great solution. The issue we have is the data comes in as displayed. What we are trying to do is not have to manipulate the data as this is the bit that takes time. So the benefit is only there is sql or php can produce the result as displayed in the result jpg. Cheers Chris
  2. honkmaster

    Sql to loop through table

    Hi, I have been stuck on best way to achieve the following (I'm still learning php and Sql so for give me if this is obvious) I have a table (See Screen Shot) which has the following headings placeID, place, job1, job2, job3, job4, job5 etc I'm trying to run query which will return as the the result screen shot attached. I'm not sure if I should be doing this within PHP or SQL? What I have is correct for job 001but i need all the other jobs underneath as in screen shot. SELECT Campaign.PlaceId, Campaign.Place, Campaign.`001` FROM Campaign WHERE Campaign.`001` >='1' Any help would be great, Cheers Chris
  3. honkmaster

    Date Time Difference Issue

    Below is code with posted data, result is 1 hr 43 mins which is incorrect, start time is 13:12 and finish is 13:55 which is 43 mins <?php $start = '1491480732'; $finish = '1491483308'; $difference = ($finish - $start); $day = round(($difference % 604800) / 86400); $hours = round((($difference % 604800) % 86400) / 3600); $minutes = round(((($difference % 604800) % 86400) % 3600) / 60); echo $day." days"."<br/>"; echo $hours." hours"."<br/>"; echo $minutes." minutes"."<br/>"; ?>
  4. honkmaster

    Date Time Difference Issue

    Hi, thanks for response, dateTime is stored as unix
  5. honkmaster

    Date Time Difference Issue

    Hi, I have two date and time stamps stored in my database, I'm using the below script to calculate the difference but whenever I'm getting an extra 1 hour added ?? Any ideas, Cheers Chris <?php $start = $row_rsComplete['quote_added']; $finish = $row_rsComplete['quote_complete']; $difference = ($finish - $start); $day = round(($difference % 604800) / 86400); $hours = round((($difference % 604800) % 86400) / 3600); $minutes = round(((($difference % 604800) % 86400) % 3600) / 60); echo $day." days"."<br/>"; echo $hours." hours"."<br/>"; echo $minutes." minutes"."<br/>"; ?>
  6. honkmaster

    Query based on todays date

    Ok that worked perfectly, thanks for help, if I wanted to use a date in the passed or future do use DATE_ADD() and DATE_SUB() instead of CURDATE() ? Once again thanks for help Cheers Chris
  7. honkmaster

    Query based on todays date

    Thanks for response but still getting a 0 count when it should return a result, if I remove date part it works so issue is with how the query is comparing the stored unix date/time and the date today 2015-06-08??
  8. honkmaster

    Query based on todays date

    Sorry here it is
  9. honkmaster

    Query based on todays date

    Hi look for some help with querying based on todays date. I'm trying to count all the entries in the database based on username, status, date. The date bit is where I' stuck (see screen shot of database) Based on data in database I should get a count of 3 but get nothing?? The result I get is 0 and should be 3 based on date Any help would be a great help Cheers Chris //date bit $d=strtotime("today"); $wholedate2 = date("Y-m-d", $d); //query $query_rsUser = "SELECT COUNT(*) FROM quotes WHERE quotes.quote_user = 'username' AND quotes.quote_complete = '$date2' AND quotes.quote_status = 'Complete'";
  10. honkmaster

    comparing dates

    I new that as well, can't see wood for trees sometimes, thanks
  11. honkmaster

    comparing dates

    Hi, I could do with a bit of help with this, not sure where I'm going wrong. The following code is used to change the colour of a row based on date. I want to compare to todays date with the following results If < today (turns red) if == today (turns orange) if > today (turns green) I have included a screen shot of result I'm getting with below if statement <?php $requireddate = date('l jS F',$row_rsActiveQuotes['quote_requireddate']); //this is anthing before today's date if ($today < $requireddate) { echo '<tr class="tableBody2">'; } //this is anthing with today's date elseif ($today == $requireddate) { echo '<tr class="tableBody3">'; } //this is anthing with today's date elseif ($today > $requireddate) { echo '<tr class="tableBody1">'; } else //this is anthing from tommorow { echo '<tr class="tableBody4">'; } ?>
  12. Hi, I'm stuck on below, I have a table called History that records date and time as timestamp, example attached below I'm trying to count the number of entries with todays date, below is the php for todays date and the query, Any one help point me in the write direction. $d=strtotime("today"); $wholedate = date("Y-m-d", $d); $date_array = explode('-', $wholedate); $date = mktime(0,0,0,(int)$date_array[1],(int)$date_array[2],(int)$date_array[0]); $query_rsWorkedToday = "SELECT COUNT(*) FROM history WHERE history_date = ‘$date’”;
×

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.