Jump to content

Zergman

Members
  • Posts

    243
  • Joined

  • Last visited

    Never

Everything posted by Zergman

  1. The more I look into it, im not sure its a actual date() issue but perhaps a mysql situation. Reading the manual on Date and Time functions for mysql, im guessing its due to the TIMESTAMP column type. CURDATE() should work, but doesn't appear to be.
  2. One problem has popped up. Since data in the database looks like this 2008-11-17 14:14:23 My normal variable of $date = date ('Y-m-d'); now doesn't work. It will only work on entries that have 00:00:00 for the time. ANything record with an actual time, won't come up in my query. Here's my query SELECT * FROM `data` WHERE tdate = '$date' ORDER BY '$slevel11' Suggests to make it search for any record for the day now that the time is included?
  3. K, changed the column to TIMESTAMP and it seems to be working as I wanted. Recording the time the entry went into the database. Just curious though if I will run into any problems with this if I decide to modify the record. Will the timestamp format change to the updated time instead of when it was submitted?
  4. I've been tasked with having our record entry page now do a time stamp along with the date. Origionally, the date column in the database was set to DATE, but since changed to DATETIME. I did set the entry page to echo as follows echo(date('c') But this will snapshot the datetime when the page loads, not when the record is submitted. How would I go about recording the date and time when the record was submitted rather when the page loads? Sometimes, its quite a few min between record entries so the time is not accurate.
  5. Great stuff, working like a charm now! Thanks for the help
  6. I got a select box as follows <select name="validmenu[]" class="inputbox" id="validmenu" size="3" multiple> <option value="*Valid*">*Valid*</option> <option value="Behaviour">Behaviour</option> <option value="Improper Abstract">Improper Abstract</option> <option value="Improper Route">Improper Route</option> <option value="Invalid STN">Invalid STN</option> <option value="Kudos">Kudos</option> <option value="Other">Other</option> <option value="Policy/Procedure">Policy/Procedure</option> <option value="Poor Ticket Creation">Poor Ticket Creation</option> <option value="Troubleshooting">Troubleshooting</option> </select> Thanks to the awesome help from the people on the boards, I have it comma separated. if (isset($_GET['validmenu'])) { $comma_separated = "'" . implode("','", $valid) . "'"; } else { $comma_separated = "'default'"; // or maybe some default value, like "'default'" } I tried the following example I found but it didn't work. <a href="sample2.php?<? for ($I=0, $I<count($array); $I++) echo "array[]={$array[$I]}&"; ?>"> How would I use a session variable to pass the array data to another page?
  7. Whats the easiest way to pass a php array to another page?
  8. boo ya! seems perfect now. A big thanks to everyone for their help! Really appreciated
  9. Ah, didn't know IN() couldn't do all. Good to know. Would it be better than to make my default a string of all options?
  10. Wicked, that got rid of the error nicely flyhoney! Only thing now LOL. .... it never ends with me .... is that my default doesn't work. Im assuming this is 100% due to my ability to write poor code. In my select box, I have sorta a default selection. This is my box. <select name="validmenu[]" class="inputbox" id="validmenu" size="4" multiple> <option value="%" selected="selected">All</option> <option value="*Valid*">*Valid*</option> <option value="Behaviour">Behaviour</option> <option value="Improper Abstract">Improper Abstract</option> <option value="Improper Route">Improper Route</option> <option value="Invalid STN">Invalid STN</option> <option value="Kudos">Kudos</option> <option value="Other">Other</option> <option value="Policy/Procedure">Policy/Procedure</option> <option value="Poor Ticket Creation">Poor Ticket Creation</option> <option value="Troubleshooting">Troubleshooting</option> </select> When All is selected, the query won't go. Only when other options are selected. What would be best to use with IN() to make it search all? the query looks like this when All is selected which won't work valid IN ('%')
  11. Awesome, thanks flyhoney! Just one last problem with all this and I think it should be good to go. When I put in that code flyhoney, I am now getting a sql syntax error. Pardon my newbish sql statment SELECT * FROM `data` WHERE tdate between '$startdate%' and '$enddate%' AND t2agent LIKE '$t2agent%' AND flagentTID LIKE '$flagent%' AND resolution LIKE '$conclusion%' AND rescomments LIKE '$conclusioncomments%' AND prov LIKE '$prov%' AND valid IN ($comma_separated) AND level1 LIKE '$level1%' AND level2 LIKE '$level2%' AND level3 LIKE '$level3%' AND notes LIKE '$notes%' ORDER BY tdate says its dealing with my "valid IN ($comma_separated)" part.
  12. Been trying to figure out how to make $_GET['validmenu'] exist before trying to use it in implode() but for the life of me, can't. Suggestions?
  13. Again, sorry for being a complete newb on this stuff. So if I understand you right, It would be best to put the code in my page after the select box? EDIT: tried that, no change. Reading your notes again, I think you mean the VALUE has to exist in $valid before implode comes into play which is why it errors until data is put in and the query is submitted ..... i think
  14. :-\ WHOOSH! that went right over my head LOL. Im so sorry, but im not experienced enough to understand any of that except for the >_< part... lol But i'll try to summarize. .... so are my variables in the right place?
  15. Not sure if this helps or not, but if I remove the code from the page, the error goes away. Same thing after the search, the error goes away till the page is reloaded. But the search and the array work fine otherwise ... stumped ???
  16. Thanks Ken, that did the trick for getting the formatting for the query right! I notice that the error is only there on the page loading. Once I run the query, the error goes away.
  17. Here's the rest of the page. Sorry if it looks a tad messed up, had to remove some stuff that I could get fired over if it was posted outside our network. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wdg="http://ns.adobe.com/addt"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Tracker Management</title> <link href="../css/<?php echo $row_rstheme['theme'] ?>" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="../includes/common/js/sigslot_core.js"></script> <script src="../includes/common/js/base.js" type="text/javascript"></script> <script src="../includes/common/js/utility.js" type="text/javascript"></script> <script type="text/javascript" src="../includes/wdg/classes/MXWidgets.js"></script> <script type="text/javascript" src="../includes/wdg/classes/MXWidgets.js.php"></script> <script type="text/javascript" src="../includes/wdg/classes/Calendar.js"></script> <script type="text/javascript" src="../includes/wdg/classes/SmartDate.js"></script> <script type="text/javascript" src="../includes/wdg/calendar/calendar_stripped.js"></script> <script type="text/javascript" src="../includes/wdg/calendar/calendar-setup_stripped.js"></script> <script src="../includes/resources/calendar.js"></script> <link href="../includes/skins/mxkollection3.css" rel="stylesheet" type="text/css" media="all" /> <script src="sorttable.js" type="text/javascript"></script> </head> <body> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="350" height="70" class="logo1"></td> <td width="350" height="70" class="logo2"></td> </tr> <tr> <td colspan="2"><hr class="style1" /></td> </tr> <tr> <td><div align="left"><a href="main.php">Main</a> | <span class="style1">></span>Search<span class="style1"><</span> | Tracking | <a href="../callDetail.php">Incident Entry</a> | <a href="javascript:;" onclick="MM_openBrWindow('monitor.php','Monitor','status=yes,scrollbars=yes,resizable=yes,width=500,height=70')">Monitor</a> | <a href="admin_users.php">Users</a></div></td> <td><div align="right">Welcome Admin <?php echo $row_rsnamedisplay['fname']; ?> <?php echo $row_rsnamedisplay['lname']; ?> | <a href="../pref.php?recordID=<?php echo $row_rsnamedisplay['id']; ?>">Preferences</a></div></td> </tr> </table> <form id="form1" name="form1" method="get" action="search.php"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td><div align="right">Start Date :</div></td> <td> <input name="startdatefield" class="inputbox" id="startdatefield" value="<?php echo $weekback; ?>" wdg:mondayfirst="true" wdg:subtype="Calendar" wdg:mask="<?php echo $KT_screen_date_format; ?>" wdg:type="widget" wdg:singleclick="true" wdg:restricttomask="no" /> <?php echo $startdate ?> <?php if ($totalRows_rsadminsearch > 0) { // Show if recordset not empty ?> (Start) <?php } // Show if recordset not empty ?></td> <td><div align="right">NS Agent :</div></td> <td><input name="nsagentfield" type="text" class="inputbox" id="nsagentfield" /> <?php echo $nsagent; ?></td> <td><div align="left">AB <input type="radio" name="radio" id="AB" value="AB" /> BC <input type="radio" name="radio" id="BC" value="BC" /> ALL <input type="radio" name="radio" id="%" value="%" /> </div></td> </tr> <tr> <td><div align="right">End Date :</div></td> <td><input name="enddatefield" class="inputbox" id="enddatefield" value="<?php echo $date; ?>" wdg:mondayfirst="true" wdg:subtype="Calendar" wdg:mask="<?php echo $KT_screen_date_format; ?>" wdg:type="widget" wdg:singleclick="true" wdg:restricttomask="no" /> <?php echo $enddate ?> <?php if ($totalRows_rsadminsearch > 0) { // Show if recordset not empty ?> (End) <?php } // Show if recordset not empty ?></td> <td><div align="right">Frontline Agent :</div></td> <td><input name="frontlineagentfield" type="text" class="inputbox" id="frontlineagentfield" /> <?php echo $flagent; ?></td> <td><div align="left">Validity : <select name="validmenu[]" class="inputbox" id="validmenu" size="4" multiple> <option value="%" selected="selected">All</option> <option value="*Valid*">*Valid*</option> <option value="Behaviour">Behaviour</option> <option value="Improper Abstract">Improper Abstract</option> <option value="Improper Route">Improper Route</option> <option value="Invalid STN">Invalid STN</option> <option value="Kudos">Kudos</option> <option value="Other">Other</option> <option value="Policy/Procedure">Policy/Procedure</option> <option value="Poor Ticket Creation">Poor Ticket Creation</option> <option value="Troubleshooting">Troubleshooting</option> </select> </div></td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td colspan="2" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><div align="right">Conclusion :</div></td> <td><div align="left"> <select name="conclusionmenu" class="inputbox" id="conclusionmenu"> <option value="%" selected="selected">All</option> <option value="Resolved" >Resolved</option> <option value="Dispatched">Dispatched</option> <option value="Other">Other</option> </select> </div></td> </tr> <tr> <td valign="middle"><div align="right">Comments :</div></td> <td><div align="left"> <textarea name="conclusioncomments" class="textarea" id="conclusioncomments" cols="30" rows="3"></textarea> </div></td> </tr> <tr> <td valign="top"> </td> <td> </td> </tr> <tr> <td><div align="right">Notes :</div></td> <td><div align="left"> <textarea name="notesfield" class="textarea" id="notesfield" cols="30" rows="3"></textarea> </div></td> </tr> <tr> <td> </td> <td> </td> </tr> </table></td> <td colspan="3"><div align="left"> <select name="state" size="10" class="textarea" id="state" onchange="setCities();"> <option value="" selected="selected"> </option> </select> <select name="city" size="10" class="textarea" id="city" onchange=" "> <option value="" selected="selected"> </option> </select> </div></td> </tr> <tr> <td valign="top"><div align="right"></div></td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td colspan="5"><div align="center"> <input type="submit" name="searchbutton" class="button1" id="searchbutton" value="Search" /><input name="resetbutton" type="button" class="button1" id="resetbutton" onclick="MM_goToURL('parent','search.php');return document.MM_returnValue" value="Reset" /> <?php if ($totalRows_rsadminsearch > 0) { // Show if recordset not empty ?> <?php echo $totalRows_rsadminsearch ?> Found <input name="excelexport" type="submit" class="button1" id="excelexport" onclick="MM_goToURL('parent','searchexport.php?startdate=<?php echo $startdate ?>&enddate=<?php echo $enddate ?>&t2agent=<?php echo $t2agent ?>&flagent=<?php echo $flagent ?>&conclusion=<?php echo $conclusion ?>&conclusioncomments=<?php echo $conclusioncomments ?>&prov=<?php echo $prov ?>&valid=<?php echo $valid ?>&level1=<?php echo $level1 ?>&level2=<?php echo $level2 ?>&level3=<?php echo $level3 ?>&notes=<?php echo $notes ?>');return document.MM_returnValue" value="Export to Excel" /> <?php } // Show if recordset not empty ?> </div></td> </tr> </table> </form> <?php if ($totalRows_rsadminsearch > 0) { // Show if recordset not empty ?> <table class="sortable" width="100%" border="0" cellspacing="0" cellpadding="0"> <thead> <tr align="left"> <th>Date</th> <th>T2 Agent</th> <th>FL Agent</th> <th>Level 1</th> <th>Level 2</th> <th>Level 3</th> <th>Province</th> <th>Validity</th> <th>Conclusion</th> </tr> </thead> <tbody> <?php do { ?> <?php $count++; if(($count % 2) == 1){ $class = "row0"; } else { $class = "row1"; } ?> <tr class="<?php echo $class; ?>"> <td width="80" onclick="MM_openBrWindow('main_quick_display.php?recordID=<?php echo $row_rsadminsearch['id']; ?>','QuickDisplay','scrollbars=yes,resizable=yes,width=500,height=400')"><a href="javascript:;"><?php echo $row_rsadminsearch['tdate']; ?></a></td> <td width="75"><?php echo $row_rsadminsearch['t2agent']; ?></td> <td width="75"><?php echo $row_rsadminsearch['flagentTID']; ?></td> <td width="135"><?php echo $row_rsadminsearch['level1']; ?></td> <td width="150"><?php echo $row_rsadminsearch['level2']; ?></td> <td width="165"><?php echo $row_rsadminsearch['level3']; ?></td> <td width="65"><?php echo $row_rsadminsearch['prov']; ?></td> <td width="115"><?php echo $row_rsadminsearch['valid']; ?></td> <td width="100"><?php echo $row_rsadminsearch['resolution']; ?></td> </tr> <?php } while ($row_rsadminsearch = mysql_fetch_assoc($rsadminsearch)); ?> </tbody> <tfoot> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </tfoot> </table> <?php } // Show if recordset not empty ?> <?php if ($totalRows_rsadminsearch == 0) { // Show if recordset empty ?> Please make you selection for search <?php } // Show if recordset empty ?> <?php function prev_month ( $now = FALSE ) { if ( !is_numeric($now) ) $now = time(); # Limit to a single date call to grab our info ( assuming parsing a string is faster than date function ) $data = date( 'n Y j t', $now ); list( $currMonth, $year, $currDay, $currDaysPerMonth ) = explode( ' ', $data ); # Find out the previous month $prevMonth = $currMonth == 1 ? 12 : $currMonth - 1; # Find out previous year $year = $prevMonth == 12 ? $year - 1 : $year; # Grab the number of days in previous month $prevDaysPerMonth = date( 't', mktime(0,0,0, $prevMonth, 1, $year) ); # See if today is greater than or the same as the total days in previous month if ( $currDay >= $prevDaysPerMonth ) return mktime( 0,0,0, $prevMonth, $prevDaysPerMonth, $year ); # Should be fine from here return mktime( 0,0,0, $prevMonth, $currDay, $year ); } # Use it! #echo date( 'Y-m-d', prev_month() ); ?> <p> <?php echo $query_rsadminsearch; ?> </p> </body> </html> <?php mysql_free_result($rsnamedisplay); mysql_free_result($rstheme); mysql_free_result($rsadminsearch); mysql_free_result($rsvalidfield); ?>
  18. gah, I hate doing this. Don't like it when people know how truely stupid I am with all of this :'( lol <?php require_once('../Connections/cnt2tracker.php'); ?> <?php //MX Widgets3 include require_once('../includes/wdg/WDG.php'); // Load the tNG classes require_once('../includes/tng/tNG.inc.php'); // Make unified connection variable $conn_cnt2tracker = new KT_connection($cnt2tracker, $database_cnt2tracker); //Start Restrict Access To Page $restrict = new tNG_RestrictAccess($conn_cnt2tracker, "../"); //Grand Levels: Level $restrict->addLevel("admin"); $restrict->Execute(); //End Restrict Access To Page if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $date = date ('Y-m-d'); $weekback = date ("Y-m-d", time() - 604800); $yesterday = date ("Y-m-d", time() - 86400); $prevmonth = date ('m', prev_month()); $month = date ('m'); $year = date ('Y'); $monthname = date ('F'); $backmonthname = date ('F', prev_month()); $orderedby = $_GET['sortby']; $lvl2display = $_GET['lvl2']; $startdate = $_GET['startdatefield']; $enddate = $_GET['enddatefield']; $t2agent = $_GET['nsagentfield']; $flagent = $_GET['frontlineagentfield']; $conclusion = $_GET['conclusionmenu']; $conclusioncomments = $_GET['conclusioncomments']; $prov = $_GET['radio']; $CBBC = $_GET['BC']; $valid = $_GET['validmenu']; $level1 = $_GET['country']; $level2 = $_GET['state']; $level3 = $_GET['city']; $notes = $_GET['notesfield']; $comma_separated = implode(",", $_GET['validmenu']); echo $comma_separated; $colname_rsnamedisplay = "-1"; if (isset($_SESSION['kt_login_user'])) { $colname_rsnamedisplay = $_SESSION['kt_login_user']; } mysql_select_db($database_cnt2tracker, $cnt2tracker); $query_rsnamedisplay = sprintf("SELECT * FROM users WHERE uname = %s", GetSQLValueString($colname_rsnamedisplay, "text")); $rsnamedisplay = mysql_query($query_rsnamedisplay, $cnt2tracker) or die(mysql_error()); $row_rsnamedisplay = mysql_fetch_assoc($rsnamedisplay); $totalRows_rsnamedisplay = mysql_num_rows($rsnamedisplay); $colname_rstheme = "-1"; if (isset($_SESSION['kt_login_user'])) { $colname_rstheme = $_SESSION['kt_login_user']; } mysql_select_db($database_cnt2tracker, $cnt2tracker); $query_rstheme = sprintf("SELECT * FROM users WHERE uname = %s", GetSQLValueString($colname_rstheme, "text")); $rstheme = mysql_query($query_rstheme, $cnt2tracker) or die(mysql_error()); $row_rstheme = mysql_fetch_assoc($rstheme); $totalRows_rstheme = mysql_num_rows($rstheme); mysql_select_db($database_cnt2tracker, $cnt2tracker); $query_rsadminsearch = "SELECT * FROM `data` WHERE tdate between '$startdate%' and '$enddate%' AND t2agent LIKE '$t2agent%' AND flagentTID LIKE '$flagent%' AND resolution LIKE '$conclusion%' AND rescomments LIKE '$conclusioncomments%' AND prov LIKE '$prov%' AND valid IN ('$comma_separated') AND level1 LIKE '$level1%' AND level2 LIKE '$level2%' AND level3 LIKE '$level3%' AND notes LIKE '$notes%' ORDER BY tdate"; $rsadminsearch = mysql_query($query_rsadminsearch, $cnt2tracker) or die(mysql_error()); $row_rsadminsearch = mysql_fetch_assoc($rsadminsearch); $totalRows_rsadminsearch = mysql_num_rows($rsadminsearch); mysql_select_db($database_cnt2tracker, $cnt2tracker); $query_rsvalidfield = "SELECT * FROM valid_entries ORDER BY entry ASC"; $rsvalidfield = mysql_query($query_rsvalidfield, $cnt2tracker) or die(mysql_error()); $row_rsvalidfield = mysql_fetch_assoc($rsvalidfield); $totalRows_rsvalidfield = mysql_num_rows($rsvalidfield); ?>
  19. Sort of? That looks correct to me! That output doesn't seem to work in my query. When I manually enter it into my sql, it works like this. valid IN ('Behaviour', 'Improper Abstract')
  20. the color was from the original script I found... just forgot to change it when I posted this to the name of my actual select box
  21. Here is the exact copy/paste from the top of my page Warning: implode() [function.implode]: Bad arguments. in /var/www/mysite.com/search.php on line 72
  22. Same error as before ... not sure whats going on Warning: implode() [function.implode]: Bad arguments But it does give me sorta the proper output when I echo it Behaviour,Improper Abstract Correct me if im wrong here. When using IN() in my sql statement, shouldn't the output be more like this? 'Behaviour', 'Improper Abstract'
  23. Having this as my select box <select name="validmenu[]" class="inputbox" id="validmenu" size="4" multiple> gives me this using print_r($_GET['validmenu']); Array ( [0] => Behaviour [1] => Improper Abstract ) Those are the two options I selected out of my box sorry bout colors, that was from the origional script
  24. Tried what you suggested flyhoney, but I got errors Warning: array_values() [function.array-values]: Warning: join() [function.join]: Bad arguments.
×
×
  • 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.