Jump to content

Barand

Moderators
  • Posts

    24,605
  • Joined

  • Last visited

  • Days Won

    830

Everything posted by Barand

  1. Just telling us that something "doesn't work" doesn't work.
  2. if (form entry is not blank) insert record else don't endif
  3. What does the highlighted code do?
  4. The clue was in "ORDER BY"
  5. The bit that tells you what the function returns, perhaps.
  6. Can't believe that query produces anything. When you say "grouped by" do you mean "ordered by"? There is a huge difference in SQL between the two.
  7. It's time to re-read the manual regarding mysqli_fetch_row()
  8. Have you ever considered looking at the manual? https://www.php.net/manual/en/class.mysqli-result.php
  9. "attendance" is a table identifier and should not, therefore, be inside quotes. Quotes are for string literals.
  10. Put this line just before you connect to the mysqli server... mysqli_report(MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT);
  11. You hope in vain. What have you tried?
  12. For $_POST['Att_date'] to exist you need a form input field with that name. The only one I see is 'Presence' Hard to tell with your complete lack of indentation, but it looks like you start a new form for every table row but only have one end-of-form tag at the end.
  13. Why are you trying to get your data from print_r() output in the first place?
  14. Identifiers names should contain [a-z][A-Z][0-9]_ characters. Hyphens are not valid. user-name is interpreted as user minus name
  15. Are you calling session_start() on each of those pages?
  16. Use a LEFT JOIN SELECT cat_title , CASE WHEN COUNT(post_id) = 0 THEN 'No posts' ELSE COUNT(post_id) END as total FROM categories c LEFT JOIN posts p ON c.cat_id = p.post_cat_id GROUP BY c.cat_title; I would also recommend using using valid column names.
  17. When it comes to it, no part of php uses () format for arrays. try [Timers] Timer[1]=50 Timer[2]=30 Timer[3]=20 with $timers = parse_ini_file('mytimers.ini', 1); echo '<pre>', print_r($timers, 1), '</pre>'; giving Array ( [Timers] => Array ( [Timer] => Array ( [1] => 50 [2] => 30 [3] => 20 ) ) )
  18. I would go for a slightly different model where the monthly charge is set for the duration of the lease. Charges can then be generated rather than having to enter them yourself. +--------------+ | unit | +--------------+ | unit_id |----+ | number | | +--------------+ | notes | | +--------------+ | payment | +--------------+ | | tenancy | +--------------+ | +--------------+ | ID | | | tenancy_ID |---------<| tenancy_ID | +--<| unit ID | | date | +---<| tenant_id | | amount | | | charge_p_m | | pay_type | (rental, deposit, contra, refund) | | start date | | notes | | | end date | +--------------+ | +--------------+ | | +--------------+ | | tenant | | +--------------+ | | tenant_id |---+ | name | | prev_address | | notes | +--------------+
  19. When I connect (once at the top of the script, not for every query) I set the option to throw exceptions so I don't have to check for them every time. This brings me back to the two lines.
  20. So while your writing try { $mydb = new DBWrapper(); // get the data and do what you want with it... $data = $mydb->readData('SELECT * FROM users where ID = :id', $userid); ... } catch (DBWrapperException $ex) { die($ex->getMessage()); } I write $data = $mydb->prepare("SELECT * FROM users WHERE ID = :id"); $data->execute(['id'=>$userid]); Not sure I'm totally sold on the benefits.
  21. Have you turned on your error reporting, because this line should give a syntax error... $sql=("SELECT * FROM $tbl_name WHERE Form_Group ='$Form_Group' AND Att_Date = '$Att_Date'";; ^ And does the date format in $Att_Date match that in the DB table (which should be yyyy-mm-dd)
  22. Both options have the same value
  23. What about Today Michael went swimming. ? [edit] And if that is deemed to be permitted, what is the rule that would disallow this one? Michael Holbrook went swimming today.
  24. What is that supposed to tell us? What is doing that it shouldn't? What is it not doing that it should? (And note that whatever group you select (A or B) it will always be "Class A" with that HTML code.)
×
×
  • 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.