Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by Barand

  1. Barand


    With all the effort you are putting into this it sounds like more than just an April 1st event. Christmas with elves, reindeer and santas perhaps? Easter eggs and bunnies? Thanksgiving turkey shoot?
  2. Barand


    I give up. Just getting towards a 500 score when I accidentally clicked the Activity tab - back to zero!. I know, I should get a life.
  3. Barand


    I see you have also increased the difficulty level and got them all breeding like rabbits
  4. Barand

    PHP7, MySQL8, Apache2.4

    Check your php.ini file. Ensure mysqli extension is enabled. Also, phpinfo() will tell you - if it is you will have a mysqli section.
  5. Barand

    onsubmit php in form

    try something like this example <script type="text/javascript"> function myFunction(myform) { return myform.selA.value != '' || myform.textB.value != '' } </script> <form action="" onsubmit="return myFunction(this)"> <select name='selA'><option value=''>- select -</option><option>AAAAAAAA</option><option>BBBBBBBBB</option></select> <input type="text" name="textB"> <input type="submit" name="btnSub" value="Submit"> </form>
  6. Barand

    onsubmit php in form

    ... and pray that the user doesn't hit the Enter button while in the text box to submit the form
  7. Barand

    Cant figure out PHP/MySQL Error

    Just to confirm Requinix's statement by psedocode examples This works: result = query(sql) or die(error message) Whereas this doesn't result = query(sql) || die(error message)
  8. Barand

    phppgadmin sql error

    In MySQL you use backticks "`" around identifiers when the identifier name is a reserved keyword or contains a space or other special characters. In your code they would not be necessary. In Postgres a different character from the backtick is used in those circumstances. The manual will tell you which. While most RDMS systems have a standard core SQL there are variations between the various dialects. You have to be aware of them.
  9. Barand

    Updating to MySQLi

    The former had a php error so gave you a php error message. The latter gives you the mysql error message. If you see the first then you won't see the second (as you found out). However the latter should tell the line number in your code where the mysql error occured. A couple of pieces of advice. 1 ) If you are moving off mysql_ functions, move to PDO and not mysqli_ functions. 2 ) If you insist on sticking with mysqli, call mysqli_report(MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT); before your mysqli connection code. That will tell mysqli to automatically report all errors without your having to use "or die()" every time.
  10. Barand

    Updating to MySQLi

    Then provide the parameter it needs. The contents of that message you have commented out should tell you what is wrong.
  11. Barand

    Updating to MySQLi

    Do you care to share with us what problem you are having? Are you getting an error message?
  12. Plus you query syntax is wrong. INSERT queries do not have a WHERE clause. Also your parameters are numbers, not strings $stmt = $conn->prepare("INSERT INTO ssm_equipment_order (equipment_quantity, job_id, equipment_id) VALUES (?,?,?) ON DUPLICATE KEY UPDATE equipment_quantity = VALUES(equipment_quantity)" ); foreach ($_POST['equipmentId'] as $k => $eid) { if ($qty[$k] > 0) { $stmt->bind_param("iii", $qty[$k], $jobId, $eid); $stmt->execute(); } } Note: If you have "... UPDATE equipment_quantity = ? " using another placeholder then you would need to add the quantity a second time in the parameters. Hence my use of the VALUES() function.
  13. Does your table have a UNIQUE constraint on those columns? UNIQUE (job_id, equipment_id)
  14. Barand

    Is this valid syntax?

    Alternatively function countIf($arr, $needle) { return count(array_keys($arr, $needle)); }
  15. Barand

    Is this valid syntax?

    try function countIf($arr, $needle) { $counts = array_count_values($arr); return $counts[$needle] ?? 0; }
  16. Add your styling to the <td>s etc when the $tdata is being built EG foreach ($res as $row) { $tot_value += $row['value']; $tot_balance += $row['balance']; // accumulate totals as they are fetched $tdata .= "<tr><td>{$row['work_order']}</td> <td>{$row['customer']}</td> <td>{$row['description']}</td>"; $tdata .= '<td class="ra">' . toCurrency($row['value']) . '</td>'; // right-align cell $tdata .= '<td class="ra">' . toCurrency($row['balance']) . '</td>'; // right-align cell $tdata .= "<td>{$row['status']}</td> <td>{$row['notes']}</td></tr>"; } $tdata .= "<tr><th colspan='3' class='ra'>Totals</th><td class='ra total'>" . toCurrency($tot_value) . '</td><td class="ra total">' . toCurrency($tot_balance) . "</td><td colspan='2'></td></tr>";
  17. If you go back to my original line 29, does it now report the error?
  18. is display_startup_errors set ON?
  19. Have you got display errors ON or are they being written to the error log?
  20. Line 29: $customer = $_GET['customer'] ?? ''; That code requires PHPv7 and should have given you an error. Change it to $customer = isset($_GET['customer']) ? $_GET['customer'] : '' ; ;
  21. What version of PHP are you using?
  22. Have you got php error reporting turned on?
  23. It was working when it left the shop.
  24. It has to be a .php file. If it's a .html file the php code won't execute and will be treated as text.

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.