Jump to content

WAMFT1

Members
  • Content Count

    64
  • Joined

  • Last visited

Community Reputation

0 Neutral

About WAMFT1

  • Rank
    Regular Member

Profile Information

  • Gender
    Male
  1. Ignore my last, I have managed to work it out. Finally.
  2. I managed to get the DateDiff working, now my Inner Join part doesn;t work. Wish I knew more about coding. Can someone please help? I can't see what is wrong. ("SELECT adviser, status, complainant, complaint_id, date_received, settlement_date, DATEDIFF(COALESCE(settlement_date, CURDATE()), date_received) as interval_days FROM `compliance_complaints` INNER JOIN eusers ON eusers.id = compliance_complaints.adviser WHERE status='Open' order by complaint_id DESC;");
  3. I don't understand how the above works the 'if' query with date. I've tried so much and I am now just getting frustrated. Going around in circles. What I have is as below, I don't know how is should be. and yes, i know i am using obsolete code but it is a temporary fix. <?php include("../edb.php"); $result=mysql_query("SELECT * FROM `compliance_complaints` INNER JOIN eusers ON eusers.id = compliance_complaints.adviser WHERE status='Closed' order by complaint_id DESC "); if($test['settlement_date']=="0000-00-00"){ $date1 = new DateTime($date_received); $date2 = new DateTime("now"); $interval = $date1->diff($date2); } else { $date1 = new DateTime($date_received); $date2 = new DateTime($settlement_date); $interval = $date1->diff($date2); } while($test = mysql_fetch_array($result)) { $complaint_id = $test['complaint_id']; echo"<tr>"; echo"<td class='standard_left'>".$test['complaint_id']."</td>"; echo"<td class='standard_left'>".$test['status']."</td>"; echo"<td class='standard_left'>".$test['LastName'].", ".$test['FirstName']."</td>"; echo"<td class='standard_left'><a href ='complaint_view.php?complaint_id=$complaint_id'>".$test['complainant']."</td>"; echo"<td class='standard_center'>".$test['date_received']."</td>"; echo"<td class='standard_center'>".$test['settlement_date']."</td>"; echo"<td class='standard_center'>".$test['interval']."</td>"; echo "</tr>"; } mysql_close($conn); ?>
  4. Hi Everyone I have an older coded side that I am looking at for a friend, I need to add in a date diff colum into their existing index page. I can add using the following code onto the indivudually record page can't get it to work on the index. Any help is appreciated. Code on Individual page which works::: <HEAD> <? if($test['settlement_date']=="0000-00-00"){ $date1 = new DateTime($date_received); $date2 = new DateTime("now"); $interval = $date1->diff($date2); } else { $date1 = new DateTime($date_received); $date2 = new DateTime($settlement_date); $interval = $date1->diff($date2); } ?> </HEAD> <Body> <?php echo "".$interval->days."";?> </BODY> I was trying to add something similar but as it is a list I can't work out what I need to do. INDEX::: while($test = mysql_fetch_array($result)) { $complaint_id = $test['complaint_id']; echo"<tr>"; echo"<td class='standard_left'>".$test['complaint_id']."</td>"; echo"<td class='standard_left'>".$test['status']."</td>"; echo"<td class='standard_left'>".$test['LastName'].", ".$test['FirstName']."</td>"; echo"<td class='standard_left'><a href ='complaint_view.php?complaint_id=$complaint_id'>".$test['complainant']."</td>"; echo"<td class='standard_center'>".$test['date_received']."</td>"; echo"<td class='standard_center'>".$test['settlement_date']."</td>"; echo"<td class='standard_center'>".$test['interval->days']."</td>"; echo "</tr>"; I know it is old redundent code but if I can get this one colum working I would be happy.
  5. Is it possible to format the menu items in the drop down box? Below is the code used at the moment. What I would like is to make Yes = Green, No = Red and N/A stay black. I tried using the class and style setting on the inline code but had no luck. Can anyone please shed some light on how I would go about this? <select name="ob_admin_quals" class="standard_left" id="ob_admin_quals"> <option value="Yes"<?php echo($ob_admin_quals == 'Yes') ? ' selected' : '';?>>Yes</option> <option value="No"<?php echo($ob_admin_quals == 'No') ? ' selected' : '';?>>No</option> <option value="N/A"<?php echo($ob_admin_quals == 'N/A') ? ' selected' : '';?>>N/A</option> </select>
  6. It looks like the issue is with the Mail::factory Fatal error: Class 'Mail' not found
  7. Crashes => When I hit submit, the update query part works fine, it seems to stop working around the sending the email part. I just get a blank screen. I don't get the email or the echo "Saved" etc. There seems to be an issue in the actual emailing part which I cannot work out.
  8. I check my code, it is just where I removed a line that I did not want to share on here. The string quote is actually closed off on the actual page.
  9. Hi All Another problem I have had since we change web hosts is that we cannot sent through phpmail any more. I have tried to update it to send through SMTP. The page works without the email sending section but with it included it crashes. I cannot see what the problems is but I do not have much experience. Any help is appreciated. <head>... <?php require("../edb.php"); $id =$_REQUEST['id']; $result = mysql_query("SELECT * FROM eusers WHERE id = '$id'"); $test = mysql_fetch_array($result); if (!$result) { die("Error: Data not found.."); } $FirstName=$test['FirstName']; $LastName=$test['LastName']; $Email=$test['Email']; $ActivateCode=$test['ActivateCode']; $Active=$test['Active']; $SecurityCode=$test['SecurityCode']; $Username=$test['Username']; if(isset($_POST['submit'])) { $FirstName_save=$_POST['FirstName']; $LastName_save=$_POST['LastName']; $Active_save=$_POST['Active']; $Email_save=$_POST['Email']; $ActivateCode_save=$_POST['ActivateCode']; $SecurityCode_save=$_POST['SecurityCode']; mysql_query("UPDATE eusers SET Active ='0', Password ='', ActivateCode ='$ActivateCode_save', Notes ='$Notes_save', SecurityCode ='' WHERE id ='$id'") or die(mysql_error("Record did not save")); //EMAIL $smtp_host = "smtp.office365.com"; $smtp_username = "XXXXXXXX"; $smtp_password = "XXXXXXXX"; $smtp_port = "587"; $to = "$FirstName $LastName <$Email> \r\n"; $email_cc = "XXXXXXXX, XXXXXXXX\r\n"; $email_from = "XXXXXXXX <XXXXXXXX> \r\n"; //$headers .= 'MIME-Version: 1.0' . "\r\n"; //$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $email_subject = "XXXXXXXX - Password Reset \r\n"; $email_message = "Hi $FirstName,<br/><br/> Your XXXXXXXX login has been reset as requested.<br/><br/> A link to the login activation page is below. All you need is a preferred password and a Security Code (anything you like) to activate your login.<br/><br/> Remember your Security Code as you will need this to change your password at a later stage. All user names and passwords are case sensitive.<br/><br/> If you have any problems or would like to discuss the XXXXXXXX please feel free to contact me on XXXXXXXX.<br/><br/> Click your Personalised Activation link to setup your login:<a href='http://www.XXXXXXXX/XXXXXXXX/login_activate.php?id=$id&ActivateCode=$ActivateCode_save'> Activate Here</a><br/><br/> For Future Reference the website details are as follows:<br/> XXXXXXXX: <a href='http://www.XXXXXXXX/XXXXXXXX'>http://www.XXXXXXXX/XXXXXXXX</a><br/> Username: $Username<br/>Registered Email: $Email<br/><br/> There's some stuff removed from here that I didn't want to share, but I also didn't fix the syntax error that removing the line caused so requinix is doing it for me"; $headers = array ('From' => $email_from, 'To' => $to, 'CC' => $email_cc, 'Subject' => $email_subject, 'Reply-To' => $smtp_username); $smtp = Mail::factory('smtp', array ('host' => $smtp_host, 'port' => $smtp_port, 'auth' => true, 'username' => $smtp_username, 'password' => $smtp_password)); $mail = $smtp->send($to, $headers, $email_message); //END EMAIL echo "Saved!"; echo "Email Sent!"; printf("<script>location.href='http://www.XXXXXXXX/XXXXXXXX/admin/index_users.php'</script>"); } ...</head>
  10. Thanks, between this and not having the code in the right place I have managed to get this working again.
  11. Hi All I am trying to use a dropdown box to get 'id' from a form and use this to update a record but I can't get it to work. I know I am using old code but don't have time to update yet. Any help would be appreciated. FORM: <form action="terminate_user.php" method="post" name="aid" id="aid"> <table width="600" border="0" class="Text_Standard"> <tr> <td><span class="standard_left">User: </span></td> <td><span class="standard_left"> <select name="aid" class="standard_left" id="aid"> <option value="" selected="selected"> </option> <?php $result = mysql_query("SELECT id, LastName, FirstName FROM `eusers` WHERE Status='CURRENT' ORDER by LastName ASC"); while ($row = mysql_fetch_array($result)){ echo '<option value="'. $row['id'] .'">'. $row['LastName'] .', '. $row['FirstName'] .'</option>'; }?> </select> <input type="Submit" name="Submit" id="Submit" value="Confirm and Terminate User" /> </form> QUERY: <?php if(isset($_POST['Submit'])) { $aid = ($_GET['aid']); //from form above $mysql_query = "UPDATE eusers SET Status='TERM' WHERE id='$aid'"; echo "Saved!"; }?>
  12. WAMFT1

    Age Code

    Thanks Barand, I have managed to get the original code working again. I checked the table structure after the move and nothing had changed there but I noticed that dates and time were not correct. I added a set timezone to the functions file and now everything seems to be working again. Thanks.
  13. WAMFT1

    Age Code

    Hi all I was using the below code on our website to return current age and it works perfectly. Recently we had to change our web host and now this piece of code seems to be a casualty to the move. The page stops loading past this point. Can anyone suggest why or what I can use in its place? I liked that it was just one line. Easy. <?php $now=new DateTime(); $birthday=new DateTime($dob); $interval= $now->diff($birthday); echo $interval->format('%Y');?>
  14. Hi all I am trying to show date different from last login to today's date. Can someone please help with where I am going wrong? <table width="730" border="0" align="center" cellpadding="4" cellspacing="0"> <tr class="beacon_heading_filled_left"> <td width="180">User</td> <td width="50">State</td> <td width="50">Adviser</td> <td width="50">STAFF</td> <td width="50">INF</td> <td width="50">FORUM</td> <td width="100">Last Login</td> <td width="50">#Days</td> <td width="50">Type</td> </tr> <?php include("../edb.php"); $result=mysql_query("SELECT * FROM `users` WHERE active='1' and UserType<>'TMP' order by LastName ASC"); while($test = mysql_fetch_array($result)) { $id = $test['id']; $timestamp = $test['Online']+36000; $current = new DateTime('now'); $diff = date_diff($current, $timestamp); echo"<tr class='beacon_standard_left'>"; echo"<td>[".$test['dlr_group']."] ".$test['LastName'].", " .$test['FirstName']."</td>"; echo"<td>".$test['State']."</td>"; echo"<td>".$test['MENUAdviser']."</td>"; echo"<td>".$test['MENUStaff']."</td>"; echo"<td>".$test['MENUINF']."</td>"; echo"<td>".$test['MENUPlatForum']."</td>"; echo"<td>" .gmdate("d M Y", $timestamp)."</td>"; echo"<td>".$diff."</td>"; echo"<td>".$test['UserType']."</td>"; echo "</tr>"; } mysql_close($conn); ?> </table>
  15. Barand, You are awesome. Works exactly how I need it to. How much do I owe you. I have spent 3 days trying to work this out.
×
×
  • 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.