Jump to content

Barand

Moderators
  • Posts

    24,573
  • Joined

  • Last visited

  • Days Won

    824

Everything posted by Barand

  1. https://lmgtfy.com/?q=html+meta+refresh
  2. A meta-refresh will do what you want <?php echo "Your pizza is ready<br>"; echo "<meta http-equiv=\"refresh\" content=\"5; url='url-to-go-to'\" />" ?>
  3. Don't hijack other people's topics Try Google
  4. One problem you have is that you cannot correctly compare date values in m/d/Y format. To compare reliably they need to be Y-m-d. 08/01/2020 > 02/01/2021 whereas 2021-01-02 > 2020-01-08 - correct
  5. RTFM https://www.php.net/manual/en/language.operators.assignment.php https://www.php.net/manual/en/language.operators.comparison.php
  6. Why have you got three tables with the same apparent structure instead of a single table with an extra column to indicate paye/contract/permanent?
  7. If it did it was only by luck. The information returned for each id could come from any of the records with that id, not necessarily the one with the max value.
  8. You need to match aginst the subquery on id and time. Table subqueries require an alias (as virtual table name) try SELECT pda.* FROM production_data_archive pda INNER JOIN ( SELECT order_id MAX(insert_time) as insert_time FROM production_status_archive GROUP BY order_id ) pda2 USING (order_id, inser_time)
  9. You have this situation if (....) { // define row row = something } echo row; // here you attempt to use row whether it was defined or not
  10. Also, your data table design is wrong. Don't store data (particularly IDs) in comma separated lists.
  11. Yes, you are - the answer was given to you ... The answer to the above question, BTW, is NO.
  12. 1) do not double post. 2) we don't like being shouted at.
  13. Barand

    Yona

    https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/required
  14. Barand

    Yona

    Adding a "required" attribute to your input fields will do it for you on the client side.. Don't forget you still need to check within PHP when you process the posted data.
  15. Your form needs name="formpay" for document.formpay to work. It also doesn't like a varaiab;e called "sum" and a function called "Sum". Try <script type="text/javascript"> function calcSum () { var Pay = document.formpay.Pay.value; var Charge = document.formpay.Charge.value; var sum = (Charge - (Pay * 1.295)); document.getElementById('Total').value = sum; } </script> <form name="formpay" action="" method="post"> <br> <br> <table> <tr> <td><input type="text" id="Pay" value="" name="Pay" placeholder="Pay"></td> </tr> <tr> <td><input type="text" id="Charge" value="" name="Charge" placeholder="Charge"></td> </tr> <tr> <td><input type="text" id="Total" value="" name="Total" placeholder="Total"></td> </tr> </table> <input type="button" name="button" Value="Calculate" onClick="calcSum()"> </form>
  16. Does it help if you force it to use numeric values? function Sum () { var Pay = parseFloat(document.formpay.Pay.value); var Charge = parseFloat(document.formpay.Charge.value); var sum = (Charge - (Pay * 1.295)); document.GetElementByid('Total').value = Sum; }
  17. if you "echo $oak" you should see that it has a value of "Cut a tree", which has a numeric value of zero. Therefore, setting the value of your column called "oak" to $oak+1 will always result in 1. What does this "users" table of yours look like?
  18. There is nothing in your form that has the name "alltree" so $_POST['alltree'] will not exist. (Turn php error reporting on. It would have told you that) The line "$oak = $_POST['oak']" is a waste of space. the column identifiers (puud, sire1) should not have the $s. mysqli_query() requires 2 parameters (see manual link provided)
  19. Use JOINs with a single query to get the information you want instead of running multiple queries If you are only retrieving a single record, don't use a while loop - a single fetch will suffice Use prepared statements - don't put variables directly into the SQL string <?php /* MK_users MK_role_access MK_baccounts +-----+---------------+ +----------+----------+ +-----+------------------------+ | uid | fullname | | role_uid | role_bid | | bid | businessname | +-----+---------------+ +----------+----------+ +-----+------------------------+ | 1 | Laura Norder | | 1 | 10 | | 10 | Amazon | | 2 | Peter Dowt | | 2 | 20 | | 20 | Apple | | 3 | Tom Di Canari | | 3 | 30 | | 30 | Paula's Poodle Parlour | +-----+---------------+ +----------+----------+ +-----+------------------------+ */ $_SESSION['id'] = 2; // provide a value $res = $conn->prepare("SELECT ba.bid , ba.businessname FROM MK_role_access ra JOIN MK_baccounts ba ON ra.role_bid = ba.bid WHERE ra.role_uid = ? "); $res->bind_param('i', $_SESSION['id']); $res->execute(); $res->bind_result($bid, $business); $res->fetch(); echo "$bid - $business <br>"; //==> 20 - Apple ?>
  20. Find a better way to store the ids than a comma-separated list.
  21. Just put a link in the head section of the HTML <!DOCTYPE html> <html lang="en"> <head> <link rel="stylesheet" href="path/to/my.css"> </head>
  22. As the string is JSON, use json_decode(); EG $str = '{ "success": true, "delivered": true, "contactDetailsRequired": false, "message": "Signed For by: D ANDERSON ", "signature": "https://webservices.thedx.co.uk/PodImage/ImageHandler.ashx?tn=906732192165", "date": "21-07-2020", "serviceLevelName": "Consigned", "time": "13:33:19", "trackedProductName": "DataExchange" }'; $data = json_decode($str); echo $data->message . '<br>'; //--> Signed For by: D ANDERSON echo $data->date . '<br>'; //--> 21-07-2020
  23. Easiest way is a DATETIME type column in your table. Give it a value NOW() when updating. This can also be automated by specifying the column default value of CURRENT_TIMESTAMP when updated.
  24. If you had used a data model like the one I suggested to you in May 2019 ... ... the coached_from and coached_until dates would give you who the coach was/is at any point in time.
  25. It isn't calling the addPostCode() function, it is just echoing its name ??? echo 'addPostCode("'.$mig_postcode.'")';
×
×
  • 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.