Jump to content

Adamhumbug

Members
  • Content Count

    290
  • Joined

  • Last visited

Everything posted by Adamhumbug

  1. I am in 100% agreement, i am afraid the stuff i am doing at the minute is not on my database and it is unlikely to get any better in the short term. So i have a person table with: id - fname - lname 1 - Adam - Smith 2 - John - Hughes I have a badge table with: badgeid - personid - zones 1 - 1 - 101,210,301,401,501,601 2 - 2 - 301,601,1101 and i need to get a list together of everyone that has more than one of the zones 301,401,501. Hopefully this does not require something as wonderful as the function in the last "mess tidying ser
  2. Hi, A person has a person id and they also have a list of zones (301,401,501,601,701 etc) I need a query that gives me the person id if their zone list contains more than one of (301,401,501) op_id - person id pr_azones - product ids I know this is going to be an IN, but not sure on the more than one bit.
  3. This unfortunately needs to to be entirely sql if that is even possible. If its not then we are where we are.
  4. I agree that this is less than ideal. As horrible as it sounds, would i be able to substring them and str_to_date them to get some of the way there?
  5. HI All, I have some dates stored as a comma sep string in a database (col = adates) The contents looks like the below 2021-04-04 07:00,2021-04-05 07:00,2021-04-06 07:00,2021-04-07 07:00,2021-04-08 07:00,2021-04-09 07:00,2021-04-10 07:00,2021-04-11 07:00,2021-04-12 07:00,2021-04-13 07:00 I am trying to select rows with 10 dates or less that are consecutive. I have done the number of dates with char_count but am struggling with the consecutive part. The table structure is id, azones Any help with this will be really appreciated as i will also need t
  6. I dont have access to the ajax function, just a function that runs at the end. I know this is pretty ambiguous but the system i am using i dont have access to the source. I have created another button that just runs the function and i click that when i can see everything is in the DOM and it still wont log (each ran) so it still cannot find the elements. But again, when i paste the code into console, i get the desired effect.
  7. If i run this line manually in the console, i get the correct number of rows showing $("[id^='OPRow']").length and if i run my function (without the function part) in console, i get the correct outcome. $("[id^='OPRow']").each(function(index, value){ console.log('each ran') var fn = $("[id^='op_firstname']", this) var ln = $("[id^='op_lastname']", this) var nation = $("[id^='op_nationality']", this) var mobile = $("input[id^='op_t1']", this) var cc = $("select[id^='op_t1d']", this) var role = $("[id^='op_role']", this) var e1 = $("[id^='op_e1']", this) var fnlabel
  8. Just to add some more clarification here. The new line is created with AJAX and i have called my function bootRow() at the end of the AJAX which i can see running in the console logs. What is not happening is the second log inside the each function suggesting that the each function is not finding the id when i can see it several times when inspecting the code and can see several of these lines on the screen. The $("[id^='OPRow']").length that i have always returns 0
  9. Perfect, thanks so much, that really helped. Has led me into another issue however (another thread). Unrelated to this answer which is perfect.
  10. Hi, I have a form to collect personal data, fn, ln, email etc. There is a button that creates a new blank line for you to fill out with another persons data. I am wanting to turn this form into a nice bootstrap layout (i have that bit sorted). This worked in my testing environment when i copied some html over (not created from the button). When you click the button you get a line like this. <tr id="OPRow605b06bd13161" class=""> <td class="BRFOPRowPhotoPreviewCell"> <input type="hidden" name="OPID605b06bd13161" id="OPID605b06bd13161" value="New">
  11. Something like this might be useful as a point to start with - this is jquery by the way $('#element').on('change', function(){ //do stuff })
  12. I think i have fixed this. Added "as newtime" after the ",time" in your example and that seems to be working when i use "newtime" in the where clause. Thanks so much as every for your continued support!!
  13. This is really useful, thanks so much. As always, one more issue. I am getting an error in the where clause. My where clause is WHERE concat(newdate, ' ', extractvalue(pr_customfields,'/CUSTOMFIELDS/CF[@CFN="TestedTime"]/@CFV')) < NOW() - INTERVAL 36 HOUR; I am getting the error - Unknown column 'pr_customfields' in 'where clause' I think the issue may have something to do with the coma in the concat but i have replaces all of your istances of "time" with the above and "date" with something very similar. The data is stored in xml in the database in the follow
  14. I have one varchar column. Unfortunately i am unable to change the table structure and have to deal with one varchar for date and one varchar for time. An example of the data is below
  15. I have a table that has dates stored in various formats (2021-03-12, 12 Mar 2021). I also have a time stored as a string (07:00) I am wanting to convert the dates in their various formats into one that can be concatonated with the time so that i can find any date/times that are 36 hours old or more. I am pretty stuck with this after trying many different ways and would really appreciate a helping hand on this. Thanks in advance.
  16. Hi, I am trying to move an element with JQ. I am wanting to add the input box to some appended content to a page. My code is below: $("[id^='OPRow']").each(function(index, value){ var fn = $("[id^='op_firstname']", this) console.log(fn) var ln = $("[id^='op_lastname']", this) var nation = $("[id^='op_nationality']", this) var mobile = $("input [id^='op_t1']", this) var cc = $("select [id^='op_t1d']", this) var role = $("[id^='op_role']", this) var e1 = $("select [id^='op_e1']", this) var cc = $("select [id^='op_t1d']", this) $('.content').app
  17. Thanks so much for your reply as always! Will the IFNULL be used in the maths at the bottom of this query? (ptsl_limit - IFNULL(used, 0)
  18. Hi All, I have the following, and when i run it the ifnull() is returning null rather than 0 as shown in the attached. Any help on this would be greatly appreciated. select * from ( SELECT ptsl_ptd_id, SUBSTRING(ptsl_date,1,10) as ptsl_date, ptsl_z_id, z_rfid, ptsl_limit FROM `prs_ptsl` inner join prs_z on ptsl_z_id=z_id where ptsl_ptd_id='7' ) as limits left join ( SELECT pr_ptd_id, za_sdate, za_z_id, za_z_rfid, IFNULL(count(za_pr_id), 0) as used FROM `prs_za` inner join prs_pr on za_pr_id=pr_id where prs_pr.pr_status = 'Approved' or prs_pr.pr_status = 'S
  19. It does not correct and actually i am having the same issue again with a similar problem.
  20. This is the modal <div class="modal fade" id="editQuoteModal" tabindex="-1"> <div class="modal-dialog modal-xl"> <div class="modal-content"> <div id='editQuoteContent'> <!-- ajax info here --> </div> </div> </div> </div> This is the ajax $('.editQuote').click(function(){ var quoteId = $(this).data("id"); $.ajax({ type: 'post', data: {"ajax" : 'one', "id" : quoteId}, success: function(resp){ $('#editQuoteContent').html(resp) } }) $('#editQuoteModal').modal({ show: true
  21. Yep that might do it. Cant see the woods for the trees! Thanks as always
  22. I have a user form with a dete button on a dropdown. When you click said button this runs function deleteUser(){ var e = event.target var uid = e.getAttribute("data-id"); console.log(e) console.log(uid) $.ajax({ type: 'post', data: {"ajax" : 'delUser', "id" : uid} }) } which goes into this if(isset($_POST['ajax'])){ switch($_POST['ajax']) { case 'newUserMod': exit(popNewUserModal()); break; case 'userMod': exit(popUserModal($_POST['id'])); break; case 'deleteUser': exit(deleteUser($_POST['id'])); break; } }; which calls this function in
  23. Hi All, I have a number of bootstrap dropdowns in a list of users, each use has one. When i click one, it drops down and i populate a modal from one of the buttons. After exiting that modal none of the other dropdowns trigger when clicked. If i reload the page, they work again for one click. I am happy to share code if required, just wanted to know if anyone had run into this? Thanks All
×
×
  • 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.