Jump to content

timcadieux

Members
  • Posts

    14
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

timcadieux's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Actually, this isn't working but I can't seem to fix it...the issuie stems from a JQuery that i'm using to add a WaterMark to the 3 fields...therefore they never actually resolve to empty as the $day has 'DD', $year = 'YYYY' and so on. I've tried adding && $day !='DD' but then nothing happens at all when I submit. So, I need to be able to submit if everythign is blank, however, if any of the Dates fields is not blank, I need to stop and produce an error. I'm not sure why i DID work for me for a while. If I disable the Jquery, it works just fine, but obviously I'd like to keep it. jQuery(function ($) { $("#DoD_YYYY").Watermark("YYYY", "#dfdae0"); }); $day = isset($_POST['DoD_DD']) ? trim($_POST['DoD_DD']) : ''; $month = isset($_POST['DoD_MM']) ? trim($_POST['DoD_MM']) : ''; $year = isset($_POST['DoD_YYYY']) ? trim($_POST['DoD_YYYY']) : ''; $errMsg =''; //Verify if ANY date fields have a value if(!empty($day) or !empty($month) or !empty($year)) { //verify that ALL date fields have a value if(empty($day) or empty($month) or empty($year)) { $errMsg = "You must enter a value in all date field"; } else { header ("Location: view-paginated.php?$day$month$year"); exit; } //Perform validation that the date fields values are a VALID date }
  2. I implemented as below, but it fires even when i just ht Search, without having entered and Dates at all..? <?php $day = isset($_POST['DoD_DD']) ? trim($_POST['DoD_DD']) : ''; $month = isset($_POST['DoD_MM']) ? trim($_POST['DoD_DD']) : ''; $year = isset($_POST['DoD_YY']) ? trim($_POST['DoD_DD']) : ''; $errMsg =''; //Verify if ANY date fields have a value if(!empty($day) || !empty($month) || !empty($year)) { //verify that ALL date fields have a value if(!empty($day) || !empty($month) || !empty($year)) { $errMsg = "You must enter a value in all date field"; } else { header ("Location: results.php"); exit; } //Perform validation that the date fields values are a VALID date } ?>
  3. I have a Search page that has some date fields that are NOT mandatory. However, if someone fills any of the Date fields (YYYY or MM or DD), I need to be certain that they've filled in all three. Any ideas? <div style="margin-top:10px;width:350px;" id="SpecificDateDiv" name="SpecificDateDiv"> <!--Dates--> <label for="DoD_YYYY" style="width:175px;">Specific Date:</label> <input id="DoD_YYYY" type="text" name="DoD_YYYY" value="" style="width:35px;"/> - <input id="DoD_MM" type="text" name="DoD_MM" value="" style="width:23px;"/> - <input id="DoD_DD" type="text" name="DoD_DD" value="" style="width:23px;" /> <a class='info' title="Search for a known Date of Death, please use indicated format YYYY-MM-DD. If you are unsure, use the Date Range field."><img src='images/grey_question-mark.gif' height='14'></a> </div>
  4. I have a Search form that has some Date fields. I have setup my query to search on a Specifc Date OR a Date Range, therefore I need to ensure that the user doesn't try to use both..Is there a way to either perform Validation on Submit or some other graceful way to ensure the don;t fill in both <label for="DoD_YYYY" style="width:175px;">Specific Date:</label> <input id="DoD_YYYY" type="text" name="DoD_YYYY" value="" style="width:35px;" value="YYYY"/> - <input id="DoD_MM" type="text" name="DoD_MM" value="" style="width:23px;"/> - <input id="DoD_DD" type="text" name="DoD_DD" value="" style="width:23px;" /> OR <label for="DoD_YYYY" style="width:175px;">Date Range:</label> <input id="Dod_YYYY_RangeStart" type="text" name="Dod_YYYY_RangeStart" value="" style="width:35px;"/> - <input id="Dod_MM_RangeStart" type="text" name="Dod_MM_RangeStart" value="" style="width:23px;" /> - <input id="Dod_DD_RangeStart" type="text" name="Dod_DD_RangeStart" value="" style="width:23px;" /> <span style="color:#666">/</span> <input id="Dod_YYYY_RangeEnd" type="text" name="Dod_YYYY_RangeEnd" value="" style="width:35px;" /> - <input id="Dod_MM_RangeEnd" type="text" name="Dod_MM_RangeEnd" value="" style="width:23px;" /> - <input id="Dod_DD_RangeEnd" type="text" name="Dod_DD_RangeEnd" value="" style="width:23px;" />
  5. so I built a simple grid that loads data based on params sent via the querystring. I'm using the same backend for both a Simple Search and Advanced Search. What I happend is a Search for Last Name and Firstname, this appears like ?lname=foo&fname=morefoo However, when my grid appears, I dsiplay ALL data related to that user on a row, ie Country, State, etc. What I want to be able to do have the CountryName hyperlinked with the params from the existing querystring and add the new params so that the querystring looks like ?lname=foo&fname=morefoo&countryId=65&stateId=129 My problem is that the Advanced search allows a user to query on these fields via dropdown, but the are Optional. Therefore I can often end up with ?lname=foo&fname=morefoo&countryId=&stateId= I need to be able to use a function that will allow me to replace an existing parm if it exists and/or append if it does not. Does that make sense. Something that would eventually look like the below echo '<td><a href=view-paginated.php?' . merge_querystring('countryID' , $row[13] ) . ' class=nodecoration>' . $row[13] . '</a></td>'; any help would be appeciated
  6. I had this same problem recently but I was able to incorporate this Class and it works flawlessly, http://www.catchmyfame.com/2011/10/23/php-pagination-class-updated-version-2/
  7. Ok, so I have need to move some data from one table to another every so often. I use the below code to simply Truncate the target table and then copy a fields from the Source table over. I only have 29 000 or so rows and I've done this type of thing before. My issue is that it's quite slow and when the Count reaches somehwere around 7000 or (easily 4-5minutes), the count seems to start back over at Zero, as though it were looping or something?? ini_set("memory_limit","256M"); set_time_limit(3000); echo "Please wait as the tables are Truncated then Synchronised."; mysql_connect($db_host,$MySqlUN,$MySqlPW); @mysql_select_db($database) or die( "Unable to select databases"); $query =" SELECT ID, Surname, Initials, Forenames FROM MAIN "; $TruncateME = mysql_query("TRUNCATE tblsearchtable ") or die ('Failed to Query Database' . mysql_error()); //TIME TO REBUILD THE TABLE FROM THE MAIN DB $result = mysql_query($query) or die($query); while ($row= mysql_fetch_array($result)) { // Update the DB fields with the Amended content $sqlStatement = "INSERT INTO tblsearchtable (ID, Surname, Initials, Forenames) VALUES ( '".mysql_real_escape_string($row['ID'])."', '".mysql_real_escape_string($row['Surname'])."', '".mysql_real_escape_string($row['Initials'])."', '".mysql_real_escape_string($row['Forenames'])."' )"; // Step 4: MySQL Query //echo $sqlStatement; $NEWresult = mysql_query($sqlStatement) or die ('Failed to Query Database' . mysql_error()); } //Close the db connection mysql_close(); $query='';
  8. I was able to get the FireScope Grid to work fine on my WAMP but when I uploaded it I was told that the driver was not loaded.! Argh. I'm not a PhP coder and I'm struggling to convert the PDO to code that I can understand and use. Any help would be appreciated. <?php include_once("settings.php"); ini_set("memory_limit","256M"); $dbh = new PDO('mysql:host=localhost;dbname=***','***','***'); if (isset($_REQUEST['firescope_grid'])) { try { $sql = "SELECT tblnames.ID, tblnames.fldsurname, tblnames.fldfirstnameinitial, tblrank.fldrank, tblservice.fldservice, tblunit.fldunit, tblcountry.fldcountry, tblcemetery.fldcemetery, 'Details' as lnk_details FROM tblnames LEFT JOIN ( tblrank, tblservice, tblunit, tblcountry, tblcounty, tblcemetery ) ON ( tblrank.ID = tblnames.tblrank_ID AND tblservice.ID = tblnames.tblservice_ID AND tblunit.ID = tblnames.tblunit_ID AND tblcountry.ID = tblnames.tblcountry_ID AND tblcounty.ID = tblnames.tblcounty_ID AND tblnames.tblcemetery_ID = tblcemetery.ID ) WHERE 1=1 "; if ($_REQUEST['firescope_grid_filterCol'] == 0 && strlen($_REQUEST['firescope_grid_filterText']) > 0) { $sql.=" AND fldsurname LIKE '%".$_REQUEST['firescope_grid_filterText']."%'"; } else if ($_REQUEST['firescope_grid_filterCol'] == 1 && strlen($_REQUEST['firescope_grid_filterText']) > 0) { $sql.=" AND fldfirstnameinitial LIKE '%".$_REQUEST['firescope_grid_filterText']."%'"; } else if ($_REQUEST['firescope_grid_filterCol'] == 2 && strlen($_REQUEST['firescope_grid_filterText']) > 0) { $sql.=" AND fldrank LIKE '%".$_REQUEST['firescope_grid_filterText']."%'"; } else if ($_REQUEST['firescope_grid_filterCol'] == 3 && strlen($_REQUEST['firescope_grid_filterText']) > 0) { $sql.=" AND fldservice LIKE '%".$_REQUEST['firescope_grid_filterText']."%'"; } else if ($_REQUEST['firescope_grid_filterCol'] == 4 && strlen($_REQUEST['firescope_grid_filterText']) > 0) { $sql.=" AND fldunit LIKE '%".$_REQUEST['firescope_grid_filterText']."%'"; } else if ($_REQUEST['firescope_grid_filterCol'] == 5 && strlen($_REQUEST['firescope_grid_filterText']) > 0) { $sql.=" AND fldcountry LIKE '%".$_REQUEST['firescope_grid_filterText']."%'"; } else if ($_REQUEST['firescope_grid_filterCol'] == 6 && strlen($_REQUEST['firescope_grid_filterText']) > 0) { $sql.=" AND fldcemetery LIKE '%".$_REQUEST['firescope_grid_filterText']."%'"; } if ($_REQUEST['firescope_grid_sortCol'] == 0) { $sql.=" ORDER BY fldsurname ".$_REQUEST['firescope_grid_sortOrder']; } else if ($_REQUEST['firescope_grid_sortCol'] == 1) { $sql.=" ORDER BY fldfirstnameinitial ".$_REQUEST['firescope_grid_sortOrder']; } else if ($_REQUEST['firescope_grid_sortCol'] == 2) { $sql.=" ORDER BY fldrank ".$_REQUEST['firescope_grid_sortOrder']; } else if ($_REQUEST['firescope_grid_sortCol'] == 3) { $sql.=" ORDER BY fldservice ".$_REQUEST['firescope_grid_sortOrder']; } else if ($_REQUEST['firescope_grid_sortCol'] == 4) { $sql.=" ORDER BY fldunit ".$_REQUEST['firescope_grid_sortOrder']; } else if ($_REQUEST['firescope_grid_sortCol'] == 5) { $sql.=" ORDER BY fldcountry ".$_REQUEST['firescope_grid_sortOrder']; } else if ($_REQUEST['firescope_grid_sortCol'] == 6) { $sql.=" ORDER BY fldcemetery ".$_REQUEST['firescope_grid_sortOrder']; } $qry = $dbh->query($sql); $rows = $qry->fetchAll(); $total = count($rows); $offset = ($_REQUEST['firescope_grid_page'] - 1) * $_REQUEST['firescope_grid_rows']; $rows = array_slice($rows, $offset, $_REQUEST['firescope_grid_rows']); // or use mysql_data_seek() // or add a `LIMIT $offset, $_REQUEST['firescope_grid_rows']` to your sql $output = ' <table align=center> <tr> <th>Surname</th> <th>Given Name/Initial</th> <th>Rank</th> <th>Service</th ><th>Unit</th> <th>Commemorated in</th> <th>Commemorated in</th> <th> </th> </tr> '; while($rows = mysql_fetch_array($result)){ $output .= '<tr> <td>'.$row['fldsurname'].'</td> <td>'.$row['fldfirstnameinitial'].'</td> <td>'.$row['fldrank'].'</td> <td>'.$row['fldservice'].'</td> <td>'.$row['fldunit'].'</td> <td>'.$row['fldcountry'].'</td> <td>'.$row['fldcemetery'].'</td> <td><a href=details.php?id='.$row['ID'].'>Details</td> '; } $output .= ' </table>'; ob_clean(); echo '<span id="firescope_grid_example_total" style="display:none">'.$total.'</span>'; echo '<span>'.$output.'</span>'; exit(); } catch(PDOException $e) { echo $e->getMessage(); } } echo $sql; ?>
  9. I bought PHP DataGrid Pro (v.5.0.3) and it 'works' fine. My problem is that I have 125 000 records. It takes PHP Datagrid a good 10-15 seconds to load the page becuase instead of using AJAX filters, it loads a Dropdown from the DB for each field you want to filter on. I need help finding something that works. I tried using the Jquery plugin at http://www.trirand.com/blog/ because it looks like it can do everything i need, but i just couldn't get it to work and the documentation (IMO) was terrrrible. All i want to do, is load about 15 records, with the rest Paged. Over each a column, a Filter that would allow you to type in the info you want to Filter on. That's not too much to ask for right? Can anyone help? Thx, i've been pulling my hair out for weeks now!
  10. I'm using the below query to count the number of Names attached to each particular Unit, but when I ran this Query, WAMP almost died and I lost control of my PC for about 5min until I stopped ALL Services. Ideas? mysql_connect($db_host,$MySqlUN,$MySqlPW); @mysql_select_db($database) or die( "Unable to select databases"); // Build SQL Query $query = "SELECT ID, fldUnit, (SELECT COUNT(*) FROM tblnames as NUMS WHERE tblUnit_ID = Units.ID) as myCount from tblunit AS Units"; $result = mysql_query($query) or die($query); // fldunit echo "<tr valign='middle'>\n"; echo "<tr>\n"; echo "<td style='background-color: #fcfaf6;'>Field Unit: "; echo "</td>\n"; echo "<td><select name='lstUnits' id='lstUnits'>\n"; // now you can display the results returned while ($row= mysql_fetch_array($result)) { echo "<option value='".$row[0]."'"; echo ">".$row[1]." ".$NUMS."-Records</option>\n"; } //Close the db connection mysql_close(); $query=''; echo "</select></td>\n"; echo "</tr>\n";
  11. Hi folkz, I have to clean up a database of Military Units and the members of each. Alot of the units appear more than once but with alternate spelling, what I was hoping to do was check the number of members in each duplicate unit, find out which one already has the most members, than just transfer the members from the other units into that one and delete the old ones. To do this I was thinking populating a ListMenu with all the units and somehow make each name clickable, which would then just give me the number of members from a lookup. Then seperatly, I would create 2 other list menu that had a MOVE to button, this would take all the members of the Clicked On group and send them into the Unit which I would have to click on in the second ListMenu. Ii hope this is clearer than mud. Anyhow, I'm looking for better ideas, if not, pointers on how to make the ListMenu show me the Count of the Members and then pointers on how I can write the Query which would take all the members from box 1 and add them as Members of what I click in box 2. Thx in advance.!!!
  12. I'm using the http://www.w3schools.com/php/php_ajax_database.asp which i modified to display a PLEASE wait while the table is loaded from another php page. The problem is that I have so much content in the db that I would like another PLEASE wait to page when the Paging is being used. IS there a way to do this? Thx in advance.
×
×
  • 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.