Jump to content

honkmaster

Members
  • Content Count

    38
  • Joined

  • Last visited

Community Reputation

0 Neutral

About honkmaster

  • Rank
    Member

Profile Information

  • Gender
    Not Telling
  1. Hi I'm trying to record the status of a user when they log out but I can't work out where I'm going wrong. Any help would be fantastic Cheers Chris Button <a href="<?php echo $logoutAction ?>">Log out</a> Log Out <?php //initialize the session if (!isset($_SESSION)) { session_start(); } // ** Logout the current user. ** $logoutAction = $_SERVER['PHP_SELF']."?doLogout=true"; if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){ $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']); //Record log in and out Status $query=("UPDATE authorise SET authorise.authorise_status = 'Logged Out' WHERE authorise.authorise_username = '$_SESSION[MM_Username]'"); $result=mysql_query($query); } if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){ //to fully log out a visitor we need to clear the session varialbles $_SESSION['MM_Username'] = NULL; $_SESSION['MM_UserGroup'] = NULL; $_SESSION['PrevUrl'] = NULL; $_SESSION["skill"] = NULL; $_SESSION["email"] = NULL; $_SESSION["firstname"] = NULL; $_SESSION["department"] = NULL; $_SESSION["fullname"] = NULL; unset($_SESSION['MM_Username']); unset($_SESSION['MM_UserGroup']); unset($_SESSION['PrevUrl']); unset($_SESSION['skill']); unset($_SESSION['email']); unset($_SESSION['firstname']); unset($_SESSION['department']); unset($_SESSION['fullname']); $logoutGoTo = "../index.php"; if ($logoutGoTo) { header("Location: $logoutGoTo"); exit; } } ?>
  2. Thank you so much, that was great and worked perfectly, is there any way of getting the Year in there as well? Cheers Chris
  3. Hi, I'm trying to Select all records in my database based on month and count them. The dates are store as unix timestamp as below. So if I wanted to return all records for November 2019 the result would be 5 based on below. I have started the query as below but I'm not sure if DATEPART() is there correct way to finish. SELECT COUNT(Target) FROM production WHERE DATE(FROM_UNIXTIME(production.Target)) = Target ---------- 1574701200 1574701200 1574701200 1574701200 1574701200 1572436800 1572436800 1572436800 Cheers Chris (PHP/SQL Novice)
  4. 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
  5. 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
  6. 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/>"; ?>
  7. Hi, thanks for response, dateTime is stored as unix
  8. 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/>"; ?>
×
×
  • 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.