Jump to content
#StayAtHome ×


  • Content Count

  • Joined

  • Last visited

  • Days Won


kicken last won the day on March 11

kicken had the most liked content!

Community Reputation

517 Excellent


About kicken

  • Rank
    Wiser? Not exactly.

Contact Methods

  • Website URL

Profile Information

  • Gender
  • Location
    Bonita, FL
  • Age

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Sounds like all you really need is a class on the parent row's <tr> tag that you can target to apply your padding. That is relatively easy to do by just querying for the .ht_nestingParent cells, getting their parent and adding a class. jQuery(function($){ $('.ht_nestingParent').each(function(){ $(this).parent().addClass('nestingParentRow'); }); }); The you could apply padding to the cells of that row to space it out from the previous section with a little CSS .nestingParentRow td { padding-top: 15px; } .nestingParentRow:first-child td { padding-top: 0; }
  2. Use the -s option: mysql -u $user -p -D $db -Nse "select blah"
  3. You need to use parameter binding rather than variable interpolation.
  4. Your query only returns one row, so there is no need for a loop. Just attempt to fetch that one row and see if any results come back. If so, check them. If not, use your default. $results = mysqli_query($con,$query); $row = mysqli_fetch_assoc($results); if ($row && $row['bookmark']){ echo '-'; } else { echo '+'; }
  5. There's two parts to this, so solve one then the other rather than doing both at the same time. First problem is saving your data. Create a function that you can call with your data and it will save it to your database. Use parameters for the function rather than accessing $_POST directly. For example: function bookmark_add($userId, $itemId){ //run INSERT statement } While getting that working, just use a normal form that will submit the data and refresh the page, eg: <?php if ($_SERVER['REQUEST_METHOD']==='POST'){ //Call your function with the data bookmark_add($_POST['userId'], $_POST['itemId']); } ?> <form method="page.php" action=""> <p>ItemID: <input type="text" name="itemId"></p> <p>UserID: <input type="text" name="userId"></p> <p><button type="submit">Save</button></p> </form> Once you have your function working exactly how you want it, then move on to your "without reloading the page problem." To do this without reloading the page, you need to use javascript to submit the values in the background using AJAX/XHR. Grab something like jQuery and use it's .post method to make this super simple. Now you create a javascript function which will gather your form data and submit it to a PHP page which then calls your PHP function to save it. For example: function submitBookmark(){ var postData = { userId: $('#userId').val() , //.... }; $.post('page.php', postData) .then(/* Success handler */) .catch(/* Failure handler */) ; } Finally setup that function to be executed whenever the user clicks your + image.
  6. You don't really need to check the previous row at all, just create a structured array with the job id as the first key and your columns/children as subkeys. $results = []; while($row = $stmt->fetch(PDO::FETCH_BOUND)) { $jobRow = &$results[$job_number]; if (!$jobRow){ //Job hasn't been seen yet so setup the first level. $jobRow = array( 'Job Number' => $job_number, 'LN #' => null, 'Description' => null, 'Qty' => null, 'AS400 Ship Date' => null, 'Date Showed on Report' => null, 'Days to Manufacture' => null, 'Notes' => null, 'Date Shown Completed' => null, 'Actual Ship Date' => null, 'Qty Shipped' => null, '__children' => [] ); } //Add child line items to the children array $jobRow['__children'][] = array( 'LN #' => $line_item, 'Description' => $description, 'Qty' => $qty, 'AS400 Ship Date' => $as400_ship_date, 'Date Showed on Report' => $date_showed_on_report, 'Days to Manufacture' => "5", 'Notes' => $notes, 'Date Shown Completed' => $date_shown_complete, 'Actual Ship Date' => $actual_ship_date, 'Qty Shipped' => $qty_shipped ); } //Output json. array_values to convert from an object map to an array. echo json_encode(array_values($results));
  7. Not really. I still don't see any reason why what you're trying to do would be any different that just reloading the entire page. In any event, if you do want to update just some areas the proper way, as mentioned, is to have your PHP generate the data as a JSON structure and then have your javascript take that and update all the relevant fields. Using .load with fragment identifiers is extremely wasteful and will put a lot of unnecessary burden on your server, potentially leading to issues. You already posted an example of using JSON, so it seems you have figured at least part of it out. What you'd do is just update your success: handler function to do what you need once the json data is received, for example to update the order number you might do: success: function(data){ $('#order-no').text(data.orderNo); } In your PHP code, make sure you output an appropriate content type before the json. Then it will be parsed automatically by jQuery and provided to your callback rather than you having to parse it yourself. header('Content-type: application/json'); echo json_encode($qryResult); exit;
  8. You should only be using one timezone in all your code and storage. UTC works well but pick whatever you want and use it. By using a single timezone and datetime types then most of this problem goes away. Regardless of what the users local timezone is, you store the date and time in your chosen timezone. Then whenever you want to compare to it you also compare the current time in your chosen timezone to that stored date and time. If you want users to view dates and times in their timezone then convert them from your chosen timezone to their timezone just prior to display. If your using generated times then things are pretty easy in general. If your taking user-submitted dates and times, then things can potentially get a little more complex. If you want users to deal with things according to their local time you'll need to convert their input from their timezone to yours before doing and processing. This is just something you need to decide as one of your business rules. You also need to decide if whatever date you pick is inclusive or exclusive. If I were to subscribe on 2020-04-17 @ 5:20, for one year then does my subscription run 2020-04-17 @ 5:20 -> 2021-04-17 @ 5:20? 2020-04-17 @ 0:00 -> 2021-04-17 0:00? 2020-04-17 @ 0:00 -> 2021-04-17 @ 23:59:59? Up to you to decide. If it were me, I'd probably go for for the last option as I think it's the most intuitive and what people would expect. People are not going to remember the exact minute they signed up, and on the scale of a year I wouldn't nit-pick a few hours.
  9. What are you actually trying to accomplish? Your original code makes it look like you're essentially just trying to refresh the current page, but doing it in pieces instead of all at once. Is there a reason you want to do it that way rather than just reload the page on a timer, such as: jQuery(function(){ //Reload the page in 3 seconds setTimeout(function(){ location.reload(); }, 3000); }); You need to explain what your end-goal is better so that you can receive a real solution to whatever the problem is.
  10. The server can't access the camera. Client-side Javascript however potentially can. It requires the user to grant permission though so it's not something you could just do sneakily in the background. So it's entirely possible to tie a click handler to your login button that would request camera access and then snap a photo and upload it.
  11. It's there, you're just looking in the wrong place probably. You have to expand the New menu first, like I said. I also gave you other ways to accomplish the same task. Pick one.
  12. For this, just right-click the desktop and do New -> Shortcut then put the URL in the text box. This will create an internet shortcut that will open in whatever your default browser is. If you want a browser specific shortcut, then you do like I posted above. Alternatively, open the website in your browser then click the icon next to the URL in the address bar and drag it to the desktop and the browser will create a shortcut to the site for you.
  13. If all you want to do is create a shortcut that opens a specific site, just add the URL you want it to open at the end of the target field. You can further customize the icon and such if you want to make it easy to distinguish. I did this on my HTPC for various streaming services. Most of those are just Firefox shortcuts with the URL added at the end and a custom icon.
  14. Using IndexedDB you'd have a fair bit of persistent storage available at your disposal. Easily enough to handle a full day's worth of surveying, probably much longer, unless your doing something that's crazy data intensive like recording video or lots of photos. You could code things to sync data to somewhere online when you do have an internet connection available such as when you connect to WiFi somewhere. You'll have to look into any compatibility issues for these features. I've not used most of them personally, nor do I use iOS so I have no idea what it does and doesn't support. Bottom line is these days you can do quite a bit if you're willing to put the time into researching what is available and how to use it properly.
  15. kicken

    simple file copying

    Why bother removing all the commented stuff before deploying? If it's commented out then it wont run. If you want some extra code to run locally for debugging then rather than constantly comment/uncomment the code make it conditional on something. For example I setup an environment variable on my development systems called DEBUG_SERVER and can test for that in the code to enable extra stuff. Finally if you really need to be doing some sort of processing before deploying, you could look into something like gulp.
  • 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.