-
Posts
337 -
Joined
-
Last visited
Posts posted by Clinton
-
-
I'm running a CRON job because I can't seem to figure out how to set the $message of the mail setting when I have multiple outputs. However, instead of displaying it all pretty it shows it in the crude HTML format which isn't good for the people receiving the information. Is there any way to make this right/better?
<?php $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'); echo "Salt Lake City Expiring Training Report - If nothing is below there are no actions needed:<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 ($row{'driverslicense'}=='0000-00-00') echo " "; elseif ($nowtrue > $driverslicense) { echo "<center> $fname $lname is due for a Drivers License renewal! It Expires $driverslicenseexpire "; } $cdlmedicalexpire = strtotime($cdlmedical.'+ 24 months'); $cdlmedicalexpire = date('n/j/Y',$cdlmedicalexpire); $cdlmedical = strtotime($cdlmedical.'+ 23 months'); $cdlmedical = date('Y-m-d',$cdlmedical); if ($row{'cdlmedical'}=='0000-00-00') echo " "; elseif($nowtrue > $cdlmedical) { echo "<center> $fname $lname is due for a CDL Medical Evaluation! It Expires $cdlmedicalexpire "; } $hazmatmedicalexpire = strtotime($hazmatmedical.'+ 12 months'); $hazmatmedicalexpire = date('n/j/Y',$hazmatmedicalexpire); $hazmatmedical = strtotime($hazmatmedical.'+ 11 months'); $hazmatmedical = date('Y-m-d',$hazmatmedical); if ($row{'hazmatmedical'}=='0000-00-00') echo " "; elseif($nowtrue > $hazmatmedical) { echo "<center> $fname $lname is due for a HazMat Medical Evaluation! It Expires $hazmatmedicalexpire "; } $kucccontractorexpire = strtotime($kucccontractor.'+ 12 months'); $kucccontractorexpire = date('n/j/Y',$kucccontractorexpire); $kucccontractor = strtotime($kucccontractor.'+ 11 months'); $kucccontractor = date('Y-m-d',$kucccontractor); if ($row{'kucccontractor'}=='0000-00-00') echo " "; elseif ($nowtrue > $kucccontractor) { echo "<center> $fname $lname is due for KUCC Contractor Orientation! It Expires $kucccontractorexpire "; } $kuccehsplanexpire = strtotime($kuccehsplan.'+ 12 months'); $kuccehsplanexpire = date('n/j/Y',$kuccehsplanexpire); $kuccehsplan = strtotime($kuccehsplan.'+ 11 months'); $kuccehsplan = date('Y-m-d',$kuccehsplan); if ($row{'kuccehsplan'}=='0000-00-00') echo " "; elseif($nowtrue > $kuccehsplan) { echo "<center> $fname $lname is due to renew the KUCC Personal EH & S Plan! It Expires $kuccehsplanexpire "; } $kuccconcentratorexpire = strtotime($kuccconcentrator.'+ 12 months'); $kuccconcentratorexpire = date('n/j/Y',$kuccconcentratorexpire); $kuccconcentrator = strtotime($kuccconcentrator.'+ 11 months'); $kuccconcentrator = date('Y-m-d',$kuccconcentrator); if ($row{'kuccconcentrator'}=='0000-00-00') echo " "; elseif ($nowtrue > $kuccconcentrator) { echo "<center> $fname $lname is due for the KUCC Hazard Recognition Concentrator Program! It Expires $kuccconcentratorexpire "; } $kuccmineexpire = strtotime($kuccmine.'+ 12 months'); $kuccmineexpire = date('n/j/Y',$kuccmineexpire); $kuccmine = strtotime($kuccmine.'+ 11 months'); $kuccmine = date('Y-m-d',$kuccmine); if ($row{'kuccmine'}=='0000-00-00') echo " "; elseif($nowtrue > $kuccmine) { echo "<center> $fname $lname is due for the KUCC Hazard Recognition Mine & Copperton Program! It Expires $kuccmineexpire "; } $kuccuppexpire = strtotime($kuccupp.'+ 12 months'); $kuccuppexpire = date('n/j/Y',$kuccuppexpire); $kuccupp = strtotime($kuccupp.'+ 11 months'); $kuccupp = date('Y-m-d',$kuccupp); if ($row{'kuccupp'}=='0000-00-00') echo " "; elseif ($nowtrue > $kuccupp) { echo "<center> $fname $lname is due for the KUCC Hazard Recognition UPP Program! It Expires $kuccuppexpire "; } $kuccpmetalsexpire = strtotime($kuccpmetals.'+ 12 months'); $kuccpmetalsexpire = date('n/j/Y',$kuccpmetalsexpire); $kuccpmetals = strtotime($kuccpmetals.'+ 11 months'); $kuccpmetals = date('Y-m-d',$kuccpmetals); if ($row{'kuccpmetals'}=='0000-00-00') echo " "; elseif($nowtrue > $kuccpmetals) { echo "<center> $fname $lname is due for the KUCC Hazard Recognition Precious Metals Program! It Expires $kuccpmetalsexpire "; } $kuccpitexpire = strtotime($kuccpit.'+ 12 months'); $kuccpitexpire = date('n/j/Y',$kuccpitexpire); $kuccpit = strtotime($kuccpit.'+ 11 months'); $kuccpit = date('Y-m-d',$kuccpit); if ($row{'kuccpit'}=='0000-00-00') echo " "; elseif ($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 ($row{'msha46'}=='0000-00-00') echo " "; elseif($nowtrue > $msha46) { echo "<center> $fname $lname is due for MSHA Part 46 Training! It Expires $msha46expire "; } $msha48expire = strtotime($msha48.'+ 12 months'); $msha48expire = date('n/j/Y',$msha48expire); $msha48 = strtotime($msha48.'+ 11 months'); $msha48 = date('Y-m-d',$msha48); if ($row{'msha48'}=='0000-00-00') echo " "; elseif ($nowtrue > $msha48) { echo "<center> $fname $lname is due for MSHA Part 48 Training! It Expires $msha48expire "; } $mvrcheckexpire = strtotime($mvrcheck.'+ 12 months'); $mvrcheckexpire = date('n/j/Y',$mvrcheckexpire); $mvrcheck = strtotime($mvrcheck.'+ 11 months'); $mvrcheck = date('Y-m-d',$mvrcheck); if ($row{'mvrcheck'}=='0000-00-00') echo " "; elseif($nowtrue > $mvrcheck) { echo "<center> $fname $lname is due for an MVR Check! It Expires $mvrcheckexpire "; } $respiratorfitexpire = strtotime($respiratorfit.'+ 12 months'); $respiratorfitexpire = date('n/j/Y',$respiratorfitexpire); $respiratorfit = strtotime($respiratorfit.'+ 11 months'); $respiratorfit = date('Y-m-d',$respiratorfit); if ($row{'respiratorfit'}=='0000-00-00') echo " "; elseif ($nowtrue > $respiratorfit) { echo "<center> $fname $lname is due for a Respirator Fit Test! It Expires $respiratorfitexpire "; } $respiratormedicalexpire = strtotime($respiratormedical.'+ 12 months'); $respiratormedicalexpire = date('n/j/Y',$respiratormedicalexpire); $respiratormedical = strtotime($respiratormedical.'+ 11 months'); $respiratormedical = date('Y-m-d',$respiratormedical); if ($row{'respiratormedical'}=='0000-00-00') echo " "; elseif($nowtrue > $respiratormedical) { echo "<center> $fname $lname is due for a Respirator Medical Evaluation! It Expires $respiratormedicalexpire "; } $substance9expire = strtotime($substance9.'+ 12 months'); $substance9expire = date('n/j/Y',$substance9expire); $substance9 = strtotime($substance9.'+ 11 months'); $substance9 = date('Y-m-d',$substance9); if ($row{'substance9'}=='0000-00-00') echo " "; elseif($nowtrue > $substance9) { echo "<center> $fname $lname is due for a NIDA 9-Panel Drug Test! It Expires $substance9expire "; } $naislifttruckexpire = strtotime($naislifttruck.'+ 24 months'); $naislifttruckexpire = date('n/j/Y',$naislifttruckexpire); $naislifttruck = strtotime($naislifttruck.'+ 23 months'); $naislifttruck = date('Y-m-d',$naislifttruck); if ($row{'naislifttruck'}=='0000-00-00') echo " "; elseif($nowtrue > $naislifttruck) { echo "<center> $fname $lname is due for the NAIS Task Training Lift Truck Training! It Expires $naislifttruckexpire "; } $naisoverheadcraneexpire = strtotime($naisoverheadcrane.'- 1 month'); $naisoverheadcraneexpire = date('Y-m-d',$naisoverheadcraneexpire); $naisoverheadcrane = strtotime($naisoverheadcrane.'+ 1 month'); $naisoverheadcrane = date('n/j/Y',$naisoverheadcrane); if ($row{'naisoverheadcrane'}=='0000-00-00') echo " "; elseif($nowtrue > $naisoverheadcrane) { echo "<center> $fname $lname is due for Overhead Crane Re-Training! It Expires $naisoverheadcrane "; } $fmchazexpire = strtotime($fmchaz.'+ 12 months'); $fmchazexpire = date('n/j/Y',$fmchazexpire); $fmchaz = strtotime($fmchaz.'+ 11 months'); $fmchaz = date('Y-m-d',$fmchaz); if ($row{'fmchaz'}=='0000-00-00') echo " "; elseif($nowtrue > $fmchaz) { echo "<center> $fname $lname is due for FMC Corp. Retraining! It Expires $fmchazexpire "; } $solvayhazexpire = strtotime($solvayhaz.'+ 12 months'); $solvayhazexpire = date('n/j/Y',$solvayhazexpire); $solvayhaz = strtotime($solvayhaz.'+ 11 months'); $solvayhaz = date('Y-m-d',$solvayhaz); if ($row{'solvayhaz'}=='0000-00-00') echo " "; elseif($nowtrue > $solvayhaz) { echo "<center> $fname $lname is due for Solvay Chemicals Retraining! It Expires $solvayhazexpire "; } $barrickhazexpire = strtotime($barrickhaz.'+ 12 months'); $barrickhazexpire = date('n/j/Y',$barrickhazexpire); $barrickhaz = strtotime($barrickhaz.'+ 11 months'); $barrickhaz = date('Y-m-d',$barrickhaz); if ($row{'barrickhaz'}=='0000-00-00') echo " "; elseif($nowtrue > $barrickhaz) { echo "<center> $fname $lname is due for Barrick Goldstrike Retraining! It Expires $barrickhazexpire "; } $uitchazexpire = strtotime($uitchaz.'+ 12 months'); $uitchazexpire = date('n/j/Y',$uitchazexpire); $uitchaz = strtotime($uitchaz.'+ 11 months'); $uitchaz = date('Y-m-d',$uitchaz); if ($row{'uitchaz'}=='0000-00-00') echo " "; elseif($nowtrue > $uitchaz) { echo "<center> $fname $lname is due for UITC Retraining! It Expires $uitchazexpire "; } $newmonthazexpire = strtotime($newmonthaz.'+ 12 months'); $newmonthazexpire = date('n/j/Y',$newmonthazexpire); $newmonthaz = strtotime($newmonthaz.'+ 11 months'); $newmonthaz = date('Y-m-d',$newmonthaz); if ($row{'newmonthaz'}=='0000-00-00') echo " "; elseif($nowtrue > $newmonthaz) { echo "<center> $fname $lname is due for Newmont Retraining! It Expires $newmonthazexpire "; } $genchemhazexpire = strtotime($genchemhaz.'+ 12 months'); $genchemhazexpire = date('n/j/Y',$genchemhazexpire); $genchemhaz = strtotime($genchemhaz.'+ 11 months'); $genchemhaz = date('Y-m-d',$genchemhaz); if ($row{'genchemhaz'}=='0000-00-00') echo " "; elseif($nowtrue > $genchemhaz) { echo "<center> $fname $lname is due for General Chemicals Retraining! It Expires $genchemhazexpire "; } $hazwoper40expire = strtotime($hazwoper40.'+ 12 months'); $hazwoper40expire = date('n/j/Y',$hazwoper40expire); $hazwoper40 = strtotime($hazwoper40.'+ 11 months'); $hazwoper40 = date('Y-m-d',$hazwoper40); if ($row{'hazwoper40'}=='0000-00-00') echo " "; elseif($nowtrue > $hazwoper40) { echo "<center> $fname $lname is due for 8-Hour Hazwoper Refresher training! It Expires $hazwoper40expire "; } $hazwoper24expire = strtotime($hazwoper24.'+ 12 months'); $hazwoper24expire = date('n/j/Y',$hazwoper24expire); $hazwoper24 = strtotime($hazwoper24.'+ 11 months'); $hazwoper24 = date('Y-m-d',$hazwoper24); if ($row{'hazwoper24'}=='0000-00-00') echo " "; elseif($nowtrue > $hazwoper24) { echo "<center> $fname $lname is due for 8-Hour Hazwoper Refresher training! It Expires $hazwoper24expire "; } $firstaidcprexpire = strtotime($firstaidcpr.'+ 12 months'); $firstaidcprexpire = date('n/j/Y',$firstaidcprexpire); $firstaidcpr = strtotime($firstaidcpr.'+ 11 months'); $firstaidcpr = date('Y-m-d',$firstaidcpr); if ($row{'firstaidcpr'}=='0000-00-00') echo " "; elseif($nowtrue > $firstaidcpr) { echo "<center> $fname $lname is due for a First-Aid/CPR Refresher Course! It Expires $firstaidcprexpire "; }} ?>
-
It was a good thing...
... and sorry... I forgot. It's early.
-
LoL. You're good. I don't care what the rest of the people write about you here... you are good.
-
I've googled the problem but everybody else's solutions is working for mine. Not sure what's wrong.
Error: Unknown column '06JU06E1' in 'where clause' (06JU06E1 is $datecode)
$sumadd = mysql_query("SELECT datecode,SUM(signin),SUM(signout) FROM transactionlog WHERE datecode = $datecode GROUP BY `datecode`") or die(mysql_error()); $num = mysql_num_rows($sumadd); if(!$num) { echo "No entries have been found for this datecode"; } else { while($row = mysql_fetch_array($sumadd)){ $totaladd = $row['SUM(signin)']; $totalsubtract = $row['SUM(signout)']; $grandtotal = ($totaladd - $totalsubtract); echo "<center>Amount in Magazine = <font color=purple>$grandtotal</font> </center>"; } }
-
What I'm looking for is a way to compile all the "RESULTS" in one screen so somebody can print out the entire active inventory in one fail swoop.
-
Ok. Here it is.
Attached:
Masterlist shows how I keep track of each individual tables and whether or not they are still active (closed).
TableExample shows how I keep track of who checks what in and out.
Result is a picture of what is outputted.
Here is what happens when somebody adds a new product to database:
<?php session_start(); $page = $_POST['page']; $datecode = $_POST['datecode']; $producttype = $_POST['producttype']; $productdescription = $_POST['productdescription']; $purchasedfrom = $_POST['purchasedfrom']; $docid = $_POST['docid']; if ( @$_SESSION['login'] == "yes" AND @$_SESSION['released'] == "0" ) { $_SESSION['location'] == $location; $tablename = "$datecode$producttype"; $username = " $password = " $hostname = " $dbhandle = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); $selected = mysql_select_db("..........) or die("Can not open the Inventory Database. Please consult your local dialing directory or try your call later."); $sql = "INSERT INTO masterlist (datecode, producttype, productdescription, purchasedfrom, docid) VALUES ('$datecode', '$producttype', '$productdescription', '$purchasedfrom', '$docid')"; echo $sql; $result = mysql_query($sql) or die(mysql_error()); $sql2 = "INSERT INTO weights(tablename) VALUES ('$tablename')"; echo $sql2; $result2 = mysql_query($sql2) or die(mysql_error()); $sql3 = "CREATE TABLE `$tablename` (id int(255) NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), datecode varchar(255), producttype varchar(255), transactiondate date, joblocation varchar(255), jobnumber varchar(255), signout varchar(255), signin varchar(255), outinby varchar(255))"; echo $sql3; $result3 = mysql_query($sql3) or die(mysql_error()); ?> <html> <head> <meta http-equiv='refresh' content='0;url=<? echo $page; ?>.php' /> <title></title> </head> <body bgcolor="#FFFFFF"> </body> </html> <? } else if ( @$_SESSION['login'] == "yes" AND @$_SESSION['released'] == "1" ) { echo "Your previous access has been revoked. <meta http-equiv='refresh' content='3;url=h "; } else { echo "You have tried to enter a Employee Area only. Please login. "; } mysql_close($dbhandle); ?>
Here is the code for the RESULT:
<?php session_start(); if ( $_GET['choice'] == "") {$choice = $_POST['choice'];} else {$choice = $_GET['choice'];} if ( $_GET['type'] == "") {$type = $_POST['type'];} else {$type = $_GET['type'];} $table = "$choice$type"; if ( @$_SESSION['login'] == "yes" AND @$_SESSION['released'] == "0" ) { $_SESSION['location'] == $location; $username = " $password = " $hostname = " $dbhandle = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); $selected = mysql_select_db("c$dbhandle) or die("Can not open the Inventory Database. Please consult your local dialing directory or try your call later."); $result = mysql_query("SELECT * FROM masterlist WHERE producttype = 'Det Cord 50 Grain' AND closed = '' ORDER BY datecode"); ?> <html> <head> <script type="text/javascript" src="calendarDateInput.js"></script> <link rel="stylesheet" type="text/css" href="bannermenu.css" /> <title><? echo $location; ?> Master Inventory Control</title> </head> <body> <div id="banner"> <h1><? echo $location; ?> Master Inventory Control<em>- 50 Grain Det Cord</em></h1> </div> <ul id="tabmenu"> <li><a href="index.php">Home</a></li> <li><a class="active" href="50grain.php">50 Det Cord</a></li> <li><a href="100grain.php">100 Det Cord</a></li> <li><a href="unigel.php">Unigel Dynamite</a></li> <li><a href="unimax.php">Unimax Dynamite</a></li> <li><a href="lpnonel.php">LP NONEL</a></li> <li><a href="msnonel.php">MS NONEL</a></li> <li><a href="electric.php">Electric</a></li> <li><a href="shocktube.php">Shock Tube</a></li> <li><a href="totals.php">Totals</a></li> </ul> <p> </p> <div id="content"> <?php if ($choice=="") { echo "<center>"; echo "Select the appropriate date code to view/edit: \n"; echo "<form action='' method='post'>\n"; echo "<select name='choice' value=''>Date Code</option>\n"; while($nt=mysql_fetch_array($result)) { echo "<option value='{$nt['datecode']}'>{$nt['datecode']}</option>\n"; } echo "</select>\n"; echo "<INPUT type=hidden name=type value='Det Cord 50 Grain'>\n"; echo "<input type='submit' value='Select'>\n"; echo "</form>"; echo "</center>"; } else { $result = mysql_query("SELECT * FROM masterlist WHERE producttype = 'Det Cord 50 Grain' AND closed = '' AND datecode = '$choice'"); while($nt=mysql_fetch_array($result)) {extract($nt); echo "<center><a href='printrecord.php?type=$type&choice=$choice'>Print Record</a></center>"; echo "<table border=1 align=center><tr><td><table> <tr><td align=right><b><font color=blue>PRODUCT TYPE:</b></font></td><td>$producttype </td></tr><tr><td align=right><b><font color=blue>PRODUCT DESCRIPTION:</b></font></td><td>$productdescription </td></tr><tr><td align=right><b><font color=blue>PURCHASED FROM:</b></font></td><td>$purchasedfrom </td></tr><tr><td align=right><b><font color=blue>DOC #:</b></font></td><td>$docid</td></tr></table></td></tr></table>"; } echo "<center><h1><b>Date Code:</b> $choice</h1></center>"; $sumadd = mysql_query("SELECT datecode,SUM(signin),SUM(signout) FROM `$table` GROUP BY `datecode`") or die(mysql_error()); while($row = mysql_fetch_array($sumadd)){ $totaladd = $row['SUM(signin)']; $totalsubtract = $row['SUM(signout)']; $grandtotal = ($totaladd - $totalsubtract); echo "<center>Amount in Magazine = <font color=purple>$grandtotal</font> </center>"; } $username2 = " $password2 = " $hostname2 = " $dbhandle2 = mysql_connect($hostname2, $username2, $password2) or die("Unable to connect to MySQL"); $selected2 = mysql_select_db("clintona_products",$dbhandle2); $powder = mysql_query("SELECT new FROM master WHERE name = '$type'") or die(mysql_error()); while($sp = mysql_fetch_array($powder)){ $new = $sp['new']; $totalgrams = ($grandtotal * $new); $totalpounds = ($totalgrams / 453.59237); echo "<center> Weight in Magazine = <font color=purple>"; echo round($totalpounds, 4); echo "</font> lbs"; } echo "<p> "; echo "<table border=1 align=center width=80%>"; echo "<tr><td><b><u><font color=blue><center>Date:</center></font></u></b></td><td><b><u><font color=blue><center>Job Location:</center></font></u></b></td><td><b><u><font color=blue><center>Job #:</center></font></b></u></td><td><b><u><font color=blue><center>Out:</center></font></u></b></td><td><b><u><font color=blue><center>In:</center></font></u></b></td><td><u><b><font color=blue><center>In/Out By:</center></font></u></b></td></tr>"; $username = " $password = " $hostname = " $dbhandle = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); $selected = mysql_select_db("clintona_".$location."Inventory",$dbhandle) or die("Can not open the Inventory Database. Please consult your local dialing directory or try your call later."); ////////////////////////////////UPDATE WEIGHT/////////////////////////////////////// $sql2 = "UPDATE weights SET currentweight = '$totalpounds' WHERE tablename = '$table'"; $result2 = mysql_query($sql2) or die(mysql_error()); //////////////////////////////SHOW POWDER TABLE/////////////////////////////////// $result3 = mysql_query("SELECT * FROM `$table` ORDER BY `transactiondate`"); while ($row2 = mysql_fetch_array($result3)) {extract($row2); echo "<tr><td><center>$transactiondate</center></td><td><center>$joblocation</center></td><td><center>$jobnumber</center></td><td><center><font color=red>$signout<font></center></td><td><center><font color=green>$signin</font></center></td><td><center>$outinby</center></td></tr>"; } echo "</table>"; ////////////////////////////////////// Delete a Record //////////////////////////////////////////// echo "<center>To close out this datecode check the box and then hit submit.</center>"; echo "<form name='hide' action='close.php' method='post'> Delete:<input type='checkbox' name='close' value='1'> <input type='hidden' name='type' value='$type' /><input type='hidden' name='choice' value='$choice' /><input type='hidden' name='page' value='50grain' /><input type='submit' value='Delete!'></form>"; ////////////////////////////////////// How To Insert a Record //////////////////////////////////////////// echo "<p> <p>"; echo "<p> <p>"; echo "<h2><center><u> How to Insert a Record: </u></h2>"; echo "When inserting a record enter it in one of three ways:<p>"; echo "<table border=1><tr><td></td><td><center>Date</td><td><center>Job Location</td><td><center>Job #:</td><td><center>Out</td><td><center>In</td><td><center>In/Out By:</td></tr>"; echo "<tr><td>How to Sign Powder <font color=green><b>IN:</b></font></td><td><center>2008-06-06</td><td><center>Rio Bravo Rocklin</td><td><center>8321-A55</td><td><font color=red><center>LEAVE BLANK!</font></td><td><center>50</td><td><center>CJA</td></tr>"; echo "<tr><td>How to Sign Powder <font color=red><b>OUT:</b></font></td><td><center>2008-06-06</td><td><center>Rio Bravo Rocklin</td><td><center>8321-A55</td><td><center>50</td><td><center><font color=red>LEAVE BLANK!</font></td><td><center>CJA</td></tr>"; echo "<tr><td>How to <font color=purple><b>INVENTORY:</b></font></td><td><center>2008-06-06</td><td><center>Inventory</td><td><center>N/A</td><td><center><font color=red>LEAVE BLANK!</font></td><td><center><font color=red>LEAVE BLANK!</font></td><td><center>CJA</td></tr>"; echo "</center>"; echo "</table>"; ////////////////////////////////////////// Insert a Record /////////////////////////////////////////////// echo "<p> <p>"; echo "<p> <p>"; echo "<h2><center><u> Insert a Record: </u></h2>"; echo "Be careful as records <font color=red>CANNOT</font> be deleted<p>"; echo "<form action='insert.php' method='post'>"; echo "<input type='hidden' name='tablename' value='$table' />"; echo "<input type='hidden' name='datecode' value='$choice' />"; echo "<input type='hidden' name='producttype' value='$type' />"; echo "<input type='hidden' name='page' value='50grain' />"; echo "<input type='hidden' name='choice' value='$choice' />"; echo "<input type='hidden' name='type' value='$type' />"; echo "<script>DateInput('transactiondate', true, 'YYYY-MM-DD')</script>"; echo "Job Location: <input type='text' name='joblocation'/>"; echo "Job #: <input type='text' name='jobnumber'/>"; echo "Out: <input type='text' name='signout'/>"; echo "In: <input type='text' name='signin'/>"; echo "Out/In By: <input type='text' name='outinby'/>"; echo "<br><input type='submit' value='Insert!'>"; echo "</form>"; } ?> </div> </body> <? } else if ( @$_SESSION['login'] == "yes" AND @$_SESSION['released'] == "1" ) { echo "Your previous access has been revoked. <meta h } else { echo "You have tried to enter a Employee Area only. Please login } ?>
[attachment deleted by admin]
-
Bueller? Bueller? Bump.
-
Ok, this is somewhat confusing and I'm not sure how to go about it.
Whenever I get a new product it is entered into the database. The database creates two new tables based on the date of the product. One table contains general information about the table, such as whether or not the table has been closed (no longer used) and the other table maintains records, such as when somebody checks the product out or in.
So right now I have about 20 tables in my database.
I want to create a master inventory list. Basically I want this list to echo all the tables that are not 'closed' and then I want it to list out all of the records that are in each table. This is going to be many pages long but I need to be able to do this.
Each product is separated into one of 8 categories so I generally search by category and then whether or not the table has been closed:
$result = mysql_query("SELECT * FROM masterlist WHERE producttype = 'Det Cord 50 Grain' AND closed = '' ORDER BY datecode");
I would need to do the same thing but after I get this result I would need to find the tables with the matching names and then show all the information in those tables.
I would imagine a where statement would be involved but I'm not exactly sure how to do this. I'm confused. :-|
-
You guys....
.... complete me.
-
I really appreciate the help. Let me just ask one more question, why would I want to use a function vs. not using a function?
-
Sorry, I tried. I'm no pro like these guys.
-
YOu're going to want to put '' around ASC as well. So 'ASC'.
-
$id = $_GET['id']; $result = mysql_query("SELECT * FROM downloads ROW $id WHERE id = ASC");
Missing the equal sign if you want it to look exactly for that.
-
Do I ever get the feeling I'm being yelled at? Yes, yes I do.
I did it exactly as he said and am still getting that error:
$username = mysql_real_escape_string($_POST['username']); function get_POST($username) { $sret = NULL; if (isset($_POST[$username])) { $username = $username; } return $sret; } $password = mysql_real_escape_string($_POST['password']); function get_POST($password) { $sret = NULL; if (isset($_POST[$password])) { $password = $password; } return $sret; }
-
$id = $_GET['id'];
echo $id;
-
Hey NW,
I did what you said but am still getting that same error:
$username = mysql_real_escape_string($_POST['username']); function get_POST($username) { $sret = NULL; if (isset($_POST[$username])) { $sret = $_POST[$username]; $sret = mysql_real_escape_string($sret); } return $sret; } $password = mysql_real_escape_string($_POST['password']); function get_POST($password) { $sret = NULL; if (isset($_POST[$password])) { $sret = $_POST[$password]; $sret = mysql_real_escape_string($sret); } return $sret; }
-
Ok, here is the error:
Fatal error: Cannot redeclare get_post() (previously declared in checkuser.php:11) in checkuser.php on line 34
Here's the code:
$username = $_POST['username']; function get_POST($username) { $sret = NULL; if (isset($_POST[$username])) { $sret = $_POST[$username]; $sret = mysql_real_escape_string($sret); } return $sret; } $password = $_POST['password']; function get_POST($password) { $sret = NULL; if (isset($_POST[$password])) { $sret = $_POST[$password]; $sret = mysql_real_escape_string($sret); } return $sret; }
-
I am trying to make it so I don't get those damned SQL Insert Attacks.
I tried using the code below but I kept getting fatal errors. Something about it not being able to recall get_post for a second time.
I tried using this at first:
$username = $_POST['username']; function get_POST($username) { $sret = NULL; if (isset($_POST[$username])) { $sret = $_POST[$username]; $sret = mysql_real_escape_string($sret); } return $sret; }
But when I got the error I took out the $username = $_POST['username']; and it still gave me the same error.
Any help would be appreciated. Thank you.
-
You'll have to use strtotime and then do equation. Basically if columntime > strtotime(columtime, +15 minutes) then update and set online status to offline. (My strtotime isn't perfect I'm recalling it off the top of my head but that's the general idea) Use the cron job to run the php file every 15 minutes after that.
-
I was kidding, hence the wink and the little laughing man. I did almost say cron it though.
-
Like I said. Column with time, Cron Job. Is there an Echo in here?
-
Sounds like you would probably want to query the session to see if it is still active. Then base it off on that. Not sure though.
-
Bump for Rarebit
-
Could you post your entire code for this:
function get_POST($username) { $sret = NULL; if (isset($_POST[$username])) { $sret = $_POST[$username]; $sret = mysql_real_escape_string($sret); } return $sret; }
I tried using it but I kept getting fatal errors. Something about it not being able to recall get_post for a second time.
I tried using this at first:
$username = $_POST['username']; function get_POST($username) { $sret = NULL; if (isset($_POST[$username])) { $sret = $_POST[$username]; $sret = mysql_real_escape_string($sret); } return $sret; }
So I took out the $username = $_POST['username']; and it still gave me the same error.
[SOLVED] MAIL() Help
in PHP Coding Help
Posted
Okay, so I tired adding the MAIL script to the code, as seen below but am getting an error. Any ideas?
Error: Parse error: syntax error, unexpected T_STRING in trainingcheck.php on line 22