Jump to content

Clinton

Members
  • Posts

    337
  • Joined

  • Last visited

Everything posted by Clinton

  1. I know it probably has something to do with the space in between MS NONEL but I'm not sure what to do. :-|
  2. if I echo $type I get 'MS NONEL' (which is correct) however when I do as done below it cuts it off: <? $result2 = mysql_query("SELECT * FROM $choice$type ORDER BY transactiondate") or die ('Error: '.mysql_error ()); ?> The result is then '5555MS' when it should be '5555MS NONEL'. But it's echoing correctly above so why would it not here?
  3. Thanks jons... and real quick, what are the \n's for?
  4. Thank you, that did work. Now how about this... ... one of the echo statements below is not... echoing. How did I go wrong there? <?php if ($choice=="") { echo "<form action='' method='post'>"; echo "<select name='choice' value=''>Date Code</option>"; echo "Select the appropriate date code to view/edit: "; ///////////////////<<<<<<<<------------- This one right here while($nt=mysql_fetch_array($result)) { echo "<option value=$nt[datecode]>$nt[datecode]</option>"; echo "<INPUT type=text name=type value='$nt[producttype]'>"; echo "<INPUT type=text name=type value='$nt[productdescription]'>"; } echo "</select>"; echo "<input type='submit' value='Select'>"; } else echo "You have selected $choice$type. Have a nice day!"; ?>
  5. When it parses it's not pulling everything through. $datecode displays right but $producttype and $productdescripton get cut off. I.E., set as VARCHAR in db, $producttype in database reads 'MS NONEL' but is only parsing 'MS'. $productdescription in db reads '20 feet long' but is only parsing the '20'. Any ideas on why this is happening? $result = mysql_query("SELECT * FROM masterlist ORDER BY datecode"); if ($choice=="") { echo "<form action='' method='post'>"; echo "<select name='choice' value=''></option>"; while($nt=mysql_fetch_array($result)) { echo "<option value=$nt[datecode]>$nt[datecode]</option>"; echo "<INPUT type=text name=type value=$nt[producttype]>"; echo "<INPUT type=text name=type value=$nt[productdescription]>"; } echo "</select>"; echo "<input type='submit' value='Select'>"; } else echo "You have selected $choice$type. Have a nice day!"; ?>
  6. I've been working to long and I'm drawing a blank and I don't have my books on me. How do you loop this to show the results until there are no more results? $result = mysql_query("SELECT * FROM masterlist ORDER BY datecode"); ???
  7. Those damned dots. I should have known. Thank you very much!
  8. Ok: This $database = ("clintona_'$location'Inventory"); equals this: clintona_'5555'Inventory This $database = ("clintona_"$location"Inventory"); equals this: Parse error: syntax error, unexpected T_VARIABLE With or without the () it doesn't matter it still gives the same. How do I get it to equal this: clintona_5555Inventory ???? Without the ' ?????
  9. This is the original code: $kuccpitexpire = strtotime($kuccpit.'+ 12 months'); $kuccpitexpire = date('n/j/Y',$kuccpitexpire); $kuccpit = strtotime($kuccpit.'+ 11 months'); $kuccpit = date('Y-m-d',$kuccpit); if ($nowtrue > $kuccpit) { echo " $fname $lname is due for the KUCC Hazard Recognition Precious Metals Program! It Expires $kuccpitexpire "; } Now, I am trying to add an If statement to the begining of it, a couple of different ways, and I can't figure it out. This is what I have currently: if ($row{'kuccpit'}=='0000-00-00') echo " "; else $kuccpitexpire = strtotime($kuccpit.'+ 12 months'); $kuccpitexpire = date('n/j/Y',$kuccpitexpire); $kuccpit = strtotime($kuccpit.'+ 11 months'); $kuccpit = date('Y-m-d',$kuccpit); ($nowtrue > $kuccpit) { echo "<center> $fname $lname is due for the KUCC Pit License! It Expires $kuccpitexpire <p></center>"; }
  10. This says if DOB is 0000-00-00 then ECHO x ELSE echo x. How do I get it to say IF DOB is 0000-00-00 then echo x ELSE IF dob is NULL then echo x ELSE echo x? <tr> <td align='right'> Date of Birth: </td><td><input type="text" name="dob" value="<? if ($row{'dob'}=='0000-00-00') echo " "; else echo date('n/j/Y',strtotime($row{'dob'})); ?>"></td> </tr>
  11. How do I format this if my passwords in the database are md8'd? <?php session_start(); include 'db.php'; $username = $_POST['username']; $password = $_POST['password']; $newpassword = $_POST['newpassword']; $confirmnewpassword = $_POST['confirmnewpassword']; $result = mysql_query("SELECT password FROM users WHERE username='$username'"); if(!$result) { echo "The username you entered does not exist"; } else if($password!= mysql_result($result, 0)) { echo "You entered an incorrect password"; } if($newpassword=$confirmnewpassword) $sql=mysql_query("UPDATE users SET password='$newpassword' where username='$username'"); if($sql) { echo "Congratulations You have successfully changed your password"; } else { echo "The new password and confirm new password fields must be the same"; } ?>
  12. That's not it. I had it opened at the top and closed at the bottom. I went through and took out all the <? ?> around php and now it works.... BUT it doesn't parse. It shows the actual code, not the results. :-|
  13. Alright, the code below looks harder than it is but really it's just repetitive. I plan on using a cron job to run this daily and I want to e-mail the output to 2 individuals. But when I try to input the whole mail bit it doesn't work. I know it has something to do with setting the $message variable I'm just not sure what to do. The first error I got was : Parse error: syntax error, unexpected '>' on line 20. Help would greatly be appreciated. Thank you. (By the way, everything works just fine until the mail variables were put in) $dbhandle = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); $selected = mysql_select_db("clintona_SLC",$dbhandle) or die("Can not open SLC Database"); $result = mysql_query("SELECT * FROM training ORDER BY lname"); $nowtrue = date('Y-m-d'); ///////////////////////Mail Starts Here////////////////////////// $subject = "Weekly Training Report!"; $message = " echo "<center><font size=6 color=blue> Salt Lake City Expiring Training Report </font><br><font color=blue>If nothing is below there are no actions needed.</font></center><p>"; while ($row=mysql_fetch_assoc($result)){ extract($row); $driverslicense = strtotime($driverslicense.'- 1 month'); $driverslicense = date('Y-m-d',$driverslicense); $driverslicenseexpire = strtotime($driverslicense.'+ 1 month'); $driverslicenseexpire = date('n/j/Y',$driverslicenseexpire); if ($nowtrue > $driverslicense) { echo "<center> $fname $lname is due for a Drivers License renewal! It Expires $driverslicenseexpire <p></center>"; } $cdlmedicalexpire = strtotime($cdlmedical.'+ 24 months'); $cdlmedicalexpire = date('n/j/Y',$cdlmedicalexpire); $cdlmedical = strtotime($cdlmedical.'+ 23 months'); $cdlmedical = date('Y-m-d',$cdlmedical); if ($nowtrue > $cdlmedical) { echo "<center> $fname $lname is due for a CDL Medical Evaluation! It Expires $cdlmedicalexpire <p></center>"; } $hazmatmedicalexpire = strtotime($hazmatmedical.'+ 12 months'); $hazmatmedicalexpire = date('n/j/Y',$hazmatmedicalexpire); $hazmatmedical = strtotime($hazmatmedical.'+ 11 months'); $hazmatmedical = date('Y-m-d',$hazmatmedical); if ($nowtrue > $hazmatmedical) { echo "<center> $fname $lname is due for a HazMat Medical Evaluation! It Expires $hazmatmedicalexpire <p></center>"; } $kucccontractorexpire = strtotime($kucccontractor.'+ 12 months'); $kucccontractorexpire = date('n/j/Y',$kucccontractorexpire); $kucccontractor = strtotime($kucccontractor.'+ 11 months'); $kucccontractor = date('Y-m-d',$kucccontractor); if ($nowtrue > $kucccontractor) { echo "<center> $fname $lname is due for KUCC Contractor Orientation! It Expires $kucccontractorexpire <p></center>"; } $kuccehsplanexpire = strtotime($kuccehsplan.'+ 12 months'); $kuccehsplanexpire = date('n/j/Y',$kuccehsplanexpire); $kuccehsplan = strtotime($kuccehsplan.'+ 11 months'); $kuccehsplan = date('Y-m-d',$kuccehsplan); if ($nowtrue > $kuccehsplan) { echo "<center> $fname $lname is due to renew the KUCC Personal EH & S Plan! It Expires $kuccehsplanexpire <p></center>"; } $kuccconcentratorexpire = strtotime($kuccconcentrator.'+ 12 months'); $kuccconcentratorexpire = date('n/j/Y',$kuccconcentratorexpire); $kuccconcentrator = strtotime($kuccconcentrator.'+ 11 months'); $kuccconcentrator = date('Y-m-d',$kuccconcentrator); if ($nowtrue > $kuccconcentrator) { echo "<center> $fname $lname is due for the KUCC Hazard Recognition Concentrator Program! It Expires $kuccconcentratorexpire <p></center>"; } $kuccmineexpire = strtotime($kuccmine.'+ 12 months'); $kuccmineexpire = date('n/j/Y',$kuccmineexpire); $kuccmine = strtotime($kuccmine.'+ 11 months'); $kuccmine = date('Y-m-d',$kuccmine); if ($nowtrue > $kuccmine) { echo "<center> $fname $lname is due for the KUCC Hazard Recognition Mine & Copperton Program! It Expires $kuccmineexpire <p></center>"; } $kuccuppexpire = strtotime($kuccupp.'+ 12 months'); $kuccuppexpire = date('n/j/Y',$kuccuppexpire); $kuccupp = strtotime($kuccupp.'+ 11 months'); $kuccupp = date('Y-m-d',$kuccupp); if ($nowtrue > $kuccupp) { echo "<center> $fname $lname is due for the KUCC Hazard Recognition UPP Program! It Expires $kuccuppexpire <p></center>"; } $kuccpmetalsexpire = strtotime($kuccpmetals.'+ 12 months'); $kuccpmetalsexpire = date('n/j/Y',$kuccpmetalsexpire); $kuccpmetals = strtotime($kuccpmetals.'+ 11 months'); $kuccpmetals = date('Y-m-d',$kuccpmetals); if ($nowtrue > $kuccpmetals) { echo "<center> $fname $lname is due for the KUCC Hazard Recognition Precious Metals Program! It Expires $kuccpmetalsexpire <p></center>"; } $kuccpitexpire = strtotime($kuccpit.'+ 12 months'); $kuccpitexpire = date('n/j/Y',$kuccpitexpire); $kuccpit = strtotime($kuccpit.'+ 11 months'); $kuccpit = date('Y-m-d',$kuccpit); if ($nowtrue > $kuccpit) { echo "<center> $fname $lname is due for the KUCC Pit License! It Expires $kuccpitexpire <p></center>"; } $msha46expire = strtotime($msha46.'+ 12 months'); $msha46expire = date('n/j/Y',$msha46expire); $msha46 = strtotime($msha46.'+ 11 months'); $msha46 = date('Y-m-d',$msha46); if ($nowtrue > $msha46) { echo "<center> $fname $lname is due for MSHA Part 46 Training! It Expires $msha46expire <p></center>"; } $msha48expire = strtotime($msha48.'+ 12 months'); $msha48expire = date('n/j/Y',$msha48expire); $msha48 = strtotime($msha48.'+ 11 months'); $msha48 = date('Y-m-d',$msha48); if ($nowtrue > $msha48) { echo "<center> $fname $lname is due for MSHA Part 48 Training! It Expires $msha48expire <p></center>"; } $mvrcheckexpire = strtotime($mvrcheck.'+ 12 months'); $mvrcheckexpire = date('n/j/Y',$mvrcheckexpire); $mvrcheck = strtotime($mvrcheck.'+ 11 months'); $mvrcheck = date('Y-m-d',$mvrcheck); if ($nowtrue > $mvrcheck) { echo "<center> $fname $lname is due for an MVR Check! It Expires $mvrcheckexpire <p></center>"; } $respiratorfitexpire = strtotime($respiratorfit.'+ 12 months'); $respiratorfitexpire = date('n/j/Y',$respiratorfitexpire); $respiratorfit = strtotime($respiratorfit.'+ 11 months'); $respiratorfit = date('Y-m-d',$respiratorfit); if ($nowtrue > $respiratorfit) { echo "<center> $fname $lname is due for a Respirator Fit Test! It Expires $respiratorfitexpire <p></center>"; } $respiratormedicalexpire = strtotime($respiratormedical.'+ 12 months'); $respiratormedicalexpire = date('n/j/Y',$respiratormedicalexpire); $respiratormedical = strtotime($respiratormedical.'+ 11 months'); $respiratormedical = date('Y-m-d',$respiratormedical); if ($nowtrue > $respiratormedical) { echo "<center> $fname $lname is due for a Respirator Medical Evaluation! It Expires $respiratormedicalexpire <p></center>"; } $substance9expire = strtotime($substance9.'+ 12 months'); $substance9expire = date('n/j/Y',$substance9expire); $substance9 = strtotime($substance9.'+ 11 months'); $substance9 = date('Y-m-d',$substance9); if ($nowtrue > $substance9) { echo "<center> $fname $lname is due for a NIDA 9-Panel Drug Test! It Expires $substance9expire <p></center>"; } $naislifttruckexpire = strtotime($naislifttruck.'+ 24 months'); $naislifttruckexpire = date('n/j/Y',$naislifttruckexpire); $naislifttruck = strtotime($naislifttruck.'+ 23 months'); $naislifttruck = date('Y-m-d',$naislifttruck); if ($nowtrue > $naislifttruck) { echo "<center> $fname $lname is due for the NAIS Task Training Lift Truck Training! It Expires $naislifttruckexpire <p></center>"; } $fmchazexpire = strtotime($fmchaz.'+ 12 months'); $fmchazexpire = date('n/j/Y',$fmchazexpire); $fmchaz = strtotime($fmchaz.'+ 11 months'); $fmchaz = date('Y-m-d',$fmchaz); if ($nowtrue > $fmchaz) { echo "<center> $fname $lname is due for FMC Corp. Retraining! It Expires $fmchazexpire <p></center>"; } $solvayhazexpire = strtotime($solvayhaz.'+ 12 months'); $solvayhazexpire = date('n/j/Y',$solvayhazexpire); $solvayhaz = strtotime($solvayhaz.'+ 11 months'); $solvayhaz = date('Y-m-d',$solvayhaz); if ($nowtrue > $solvayhaz) { echo "<center> $fname $lname is due for Solvay Chemicals Retraining! It Expires $solvayhazexpire <p></center>"; } $barrickhazexpire = strtotime($barrickhaz.'+ 12 months'); $barrickhazexpire = date('n/j/Y',$barrickhazexpire); $barrickhaz = strtotime($barrickhaz.'+ 11 months'); $barrickhaz = date('Y-m-d',$barrickhaz); if ($nowtrue > $barrickhaz) { echo "<center> $fname $lname is due for Barrick Goldstrike Retraining! It Expires $barrickhazexpire <p></center>"; } $uitchazexpire = strtotime($uitchaz.'+ 12 months'); $uitchazexpire = date('n/j/Y',$uitchazexpire); $uitchaz = strtotime($uitchaz.'+ 11 months'); $uitchaz = date('Y-m-d',$uitchaz); if ($nowtrue > $uitchaz) { echo "<center> $fname $lname is due for UITC Retraining! It Expires $uitchazexpire <p></center>"; } $newmonthazexpire = strtotime($newmonthaz.'+ 12 months'); $newmonthazexpire = date('n/j/Y',$newmonthazexpire); $newmonthaz = strtotime($newmonthaz.'+ 11 months'); $newmonthaz = date('Y-m-d',$newmonthaz); if ($nowtrue > $newmonthaz) { echo "<center> $fname $lname is due for Newmont Retraining! It Expires $newmonthazexpire <p></center>"; } $genchemhazexpire = strtotime($genchemhaz.'+ 12 months'); $genchemhazexpire = date('n/j/Y',$genchemhazexpire); $genchemhaz = strtotime($genchemhaz.'+ 11 months'); $genchemhaz = date('Y-m-d',$genchemhaz); if ($nowtrue > $genchemhaz) { echo "<center> $fname $lname is due for General Chemicals Retraining! It Expires $genchemhazexpire <p></center>"; } $hazwoper40expire = strtotime($hazwoper40.'+ 12 months'); $hazwoper40expire = date('n/j/Y',$hazwoper40expire); $hazwoper40 = strtotime($hazwoper40.'+ 11 months'); $hazwoper40 = date('Y-m-d',$hazwoper40); if ($nowtrue > $hazwoper40) { echo "<center> $fname $lname is due for 8-Hour Hazwoper Refresher training! It Expires $hazwoper40expire <p></center>"; } $hazwoper24expire = strtotime($hazwoper24.'+ 12 months'); $hazwoper24expire = date('n/j/Y',$hazwoper24expire); $hazwoper24 = strtotime($hazwoper24.'+ 11 months'); $hazwoper24 = date('Y-m-d',$hazwoper24); if ($nowtrue > $hazwoper24) { echo "<center> $fname $lname is due for 8-Hour Hazwoper Refresher training! It Expires $hazwoper24expire <p></center>"; } $firstaidcprexpire = strtotime($firstaidcpr.'+ 12 months'); $firstaidcprexpire = date('n/j/Y',$firstaidcprexpire); $firstaidcpr = strtotime($firstaidcpr.'+ 11 months'); $firstaidcpr = date('Y-m-d',$firstaidcpr); if ($nowtrue > $firstaidcpr) { echo "<center> $fname $lname is due for a First-Aid/CPR Refresher Course! It Expires $firstaidcprexpire <p></center>"; } } ///////////////// Mail Finishes Here ///////////////////////// This is an automated response, please do not reply!"; mail((binaryblaster@gmail.com,jami_boggs@hotmail.com), $subject, $message, "From: NorthAmerican Services Group<binaryblaster@gmail.com>\n X-Mailer: PHP/" . phpversion()); ?>
  14. I had to change back the times to 0000-00-00 in order for it to be recognized. Once I did that it worked.
  15. Here's the Output: If 4/24/2008 > 3/10/2008 then show Warning Message. Clinton Andersen is due for a CDL Medical Evaluation! It Expires 4/10/2008 If 4/24/2008 > 3/23/2009 then show Warning Message. Bobby Brown is due for a CDL Medical Evaluation! It Expires 4/23/2009 ******* Clearly 4/24/08 is not greater than 3/23/09 ********* If 4/24/2008 > 3/17/2008 then show Warning Message. Monster Cookie is due for a CDL Medical Evaluation! It Expires 4/17/2008 Here's the Code: $dbhandle = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); $selected = mysql_select_db("clintona_SLC",$dbhandle) or die("Can not open SLC Database"); $result = mysql_query("SELECT lname, fname, cdlmedical FROM training ORDER BY lname"); $now = date('n/j/Y'); while ($row=mysql_fetch_assoc($result)){ extract($row); $cdlmedicalexpire = strtotime($cdlmedical.'+ 12 months'); $cdlmedicalexpire = date('n/j/Y',$cdlmedicalexpire); $cdlmedical = strtotime($cdlmedical.'+ 11 months'); $cdlmedical = date('n/j/Y',$cdlmedical); echo "<br>If $now > $cdlmedical then show Warning Message."; if ($now > $cdlmedical) { echo "<center> $fname $lname is due for a CDL Medical Evaluation! It Expires $cdlmedicalexpire </center>"; }} ?> What's wrong here?
  16. Yea, that was a bone headed mistake. Thank you.
  17. I don't see why this wouldn't work but can I not set a parameter using a parameter? $cdlmedicaltrue = $cdlmedical; <? $result = mysql_query("SELECT lname, fname, cdlmedical FROM training ORDER BY lname"); $now = date('n/j/Y'); $cdlmedicaltrue = $cdlmedical; echo "Real Date: $cdlmedicaltrue"; $cdlmedicaltrue = date('n/j/Y',$cdlmedicaltrue); while ($row=mysql_fetch_assoc($result)){ extract($row); $cdlmedical = strtotime($cdlmedical.'+ 11 months'); $cdlmedical = date('n/j/Y',$cdlmedical); if ($now>=$cdlmedical) echo "$fname $lname is due for a CDL Medical Evaluation! It Expires $cdlmedicaltrue"; else echo " "; } ?>
  18. That is what I was asking. Thank you for your help. Sorry Ken, next time I'll try to do a little more research.
  19. Here' a question: Why the '.' (dot) after $cdlmedical?
  20. Thanks Guy. And Ken, I did look at the manual. I even looked multiple places. That's how I was able to attempt putting that whole contraption together. I couldn't figure out why it wasn't working so I posted here for help. Thought I was allowed to do that.
  21. $cdlmedical is a date in my database. I have one row currently and the date in there is 4-4-2007. When I try to add 11 months to it and output it I am getting the default time 12/31/1969. Where am I going wrong? while ($row=mysql_fetch_assoc($result)){ extract($row); echo "$cdlmedical <br />"; $cdlmedical = date('$cdlmedical',strtotime('+ 11 months')); $cdlmedical = date('n/j/Y',strtotime($cdlmedical)); echo "$lname $cdlmedical"; }
  22. Never mind. When they log in I set a session variable to yes and it ran the ELSE statement. If works fine I just want to see if any of you professionals see any problem with it. Thanks! <? session_start(); if ( @$_SESSION['login'] == "yes") { echo "Welcome ". $_SESSION['first'] ." ". $_SESSION['last'] ." Login: ". $_SESSION['login'] ."! You have made it to the members area!<br /><br />"; echo "Your user level is ". $_SESSION['user_level']." which enables you access to the following areas: <br />"; if($_SESSION['user_level'] == 0){ echo "- Forums<br />- Chat Room<br />"; } if($_SESSION['user_level'] == 1){ echo "- Forums<br />- Chat Room<br />- Moderator Area<br />"; } echo "<br /><a href=logout.php>Logout</a>"; } else { echo "You have tried to enter a Employee Area only. Please login. <meta http-equiv='refresh' content='3;url=http://www.clintonandersen.name/NASG' /> "; } ?> <html> <head> <title></title> </head> <body bgcolor="#FFFFFF"> </body> </html>
  23. I am using this system located here to give me a base: http://www.devarticles.com/c/a/PHP/Creating-a-Membership-System/2/ This is the first page that someone comes to once they are logged in. It works just fine when logged in. When you are logged out it still displays this page just without the name. How do I prevent this? Do I use the session ID and include everything in an ELSE statement? If !.$SESSION['id'] then show nothing ELSE show the code below? <? session_start(); echo "Welcome ". $_SESSION['first_name'] ." ". $_SESSION['last_name'] ."! You have made it to the members area!<br /><br />"; echo "Your user level is ". $_SESSION['user_level']." which enables you access to the following areas: <br />"; if($_SESSION['user_level'] == 0){ echo "- Forums<br />- Chat Room<br />"; } if($_SESSION['user_level'] == 1){ echo "- Forums<br />- Chat Room<br />- Moderator Area<br />"; } echo "<br /><a href=logout.php>Logout</a>"; ?> <html> <head> <title></title> </head> <body bgcolor="#FFFFFF"> </body> </html>
  24. Well, I was using POST instead of GET. That was that problem. But now I am getting, when logging out an error that says: Warning: Cannot modify header information - headers already sent
×
×
  • 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.