Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About KateMacwil

  • Rank
  1. KateMacwil

    Custom Field Not Displaying

    Hi I have a added a custom field to my posts called "Event Date". When I display my widget sidebar for recent posts the text "Event Date:" is showing, however my php variable is displaying instead of its contents. I have tried surrounding this var in <?php $sEventDate ?> - and nothing displays. I have also tried this: <?php echo $sEventDate ?> and still nothing displays What have I done wrong?
  2. KateMacwil

    Format Date Not Working

    Hi I am would like to display the date as "Jan. 3, 2018" (example). I have tried a few variations of trying to format my date field to the above and nothing is wokring for me. <?php $sEventDate = get_post_meta (get_the_ID(), "meta-text2", true); if ($sEventDate) { echo "<div style=font-size: 14px;'>Event Date: $sEventDate</div>"; } else { echo "<div style=font-size: 14px;'>Event Date: --</div>"; } ?>
  3. KateMacwil

    Get Max Value Question

    When I run this: SELECT LEFT(id,3) FROM $table_name WHERE RIGHT(RTRIM(id), 4) = $sYear and then echo out the $row->id; nothing displays
  4. KateMacwil

    Get Max Value Question

    Hi In my tenders table, I have a field called "id". The format of this field is "NNN-YYYY". Each tender that is added for the current year, 1 is added to the first 3 digits of the id field. Example: 100,2018, 101-2018, 102-2018, etc. Every year, the tender # is reset to 100 and the year is changed to current year. Example: 100-2019, 101-2019 etc. I have written the following statement and run the query below and it doesn't work ($sYear = current year) SELECT MAX(LEFT(id,3)) AS iMax FROM $table_name WHERE RIGHT(RTRIM(id), 4) = $sYear If I remove the LEFT(id,3), it does. SELECT MAX(id) AS iMax FROM $table_name WHERE RIGHT(RTRIM(id), 4) = $sYear So my MAX code isn't working and I am not able to : 1) Figure out what is wrong with MAX(LEFT(id,3)) 2) Display and assign the iMax variable to a PHP variable Thanks. Below is my code: function GetNextTenderID() { global $wpdb; $table_name = $wpdb->prefix . "tenders"; $sYear = date("Y"); $sSql = "SELECT MAX(id) AS iMax FROM $table_name WHERE RIGHT(RTRIM(id), 4) = $sYear"; $rows = $wpdb->get_results($sSql); $rowcount = $wpdb->num_rows; if ($rows) { echo "Test to see if id displays" . $row->id; $old_num = $row->id; $new_num = (how do I get iMax) + 1; } return $sTemp; } Thanks.
  5. KateMacwil

    onchange event question

    HI I tried passing the id and it didn't work
  6. KateMacwil

    onchange event question

    HI I have 3 select drop downs on my page - Status, Type and Year. Each have a few options the user can select from. When the user selects an option, a textbox is updated with this value. Each select drop down has their own onchange function, Below is an example of the Year select drop down. <select class="custom-select" name="filter-year" onchange="FilterTendersYear(this);">> Here is my Javascript for this: function FilterTendersYear(selectObject) { var value = selectObject.value; document.getElementById("textbox-year").value = value; } How can I re-write this function so that it will work with all my 3 select boxes on the same page?
  7. Hi I have created a file called tenders-update.php which allows the user to update an existing record. One of the fields (a select element called "type") is on this page. I have defined an array of available options for the type as follows: $options = array ('Construction' => 'Construction', 'Goods' => 'Goods', 'Services' => 'Services'); I have also written a function which takes the $options array and the $type variable: MakeTypeOpts($options, $type) When I run this page, the select list contains the contents of the $options variable over and over and the $type variable is not selected. I am trying to figure out what I'm doing wrong here. tender-functions.php tenders-update.php
  8. KateMacwil

    CSS for href Not Working as Expected

    Thank you! I will swap out the table to a div
  9. KateMacwil

    CSS for href Not Working as Expected

    Hi I have created styles for my menu which aren't working as expected. I have attached a small portion of my page so you can see where I have referenced my menu class in the menu links. Although you can't see the call to my style sheet, it is in my original code. The menu links turn white on load and when I hover over the menu item, the underline works. However the active link is not working. tender-options.php styles.css
  10. KateMacwil

    Issue Writing Code for Download CSV File

    Thank you - great advice.
  11. KateMacwil

    Validiating Field Before Updating

    Hi I have a php page called "tenders-add.php" that allows the user to add a record to the "tenders" table. The first field in the table is called "ID" and this field needs to be unique. In javascript, I have validated that the field is not empty, but I need to check somehow in my php code that this field is also unique to the table. I am stuck on how to accomplish this. tenders-add.php
  12. KateMacwil

    Issue Writing Code for Download CSV File

    Hi I have written php code that displays to the user a list of all tenders in a database table. The user can sort on options displayed in the dropdown box and once a filter option is selected, the view automatically updates based on the selection. This part is working for me. However, I was trying to write code so that when you click the Download image on the page, a csv file is created containing the contents of the filtered view that is currently displayed. This part isn't working for me and any help pointing me in the right direction would be much appreciated. tender-functions.php tenders-list.php
  13. KateMacwil

    My Field Validation Code Not Working

    I fixed it - thanks for the help.
  14. KateMacwil

    Using iframe to display a php file

    Thank u westman Works perfectly!
  15. KateMacwil

    My Field Validation Code Not Working

    Hi I have attached the validate.js file