Jump to content

Barand

Moderators
  • Content Count

    21,307
  • Joined

  • Last visited

  • Days Won

    534

Barand last won the day on January 14

Barand had the most liked content!

Community Reputation

1,617 Excellent

About Barand

Profile Information

Recent Profile Visitors

65,484 profile views
  1. You should have searched these forums for "calendar"...
  2. I'd be tempted to have an age_group table (id, group_name, lo_age, hi_age) and join to that on if_age BEWEEN lo_age AND hi_age. It would save all those case statements and ensure consistency. BTW, your current age ranges exclude 80 year olds.
  3. No need. That happens automatically. It's a case of "set it, forget it"
  4. That still isn't going to work! (unless you aren't using PDO as you stated) mysqli_query() is not a PDO method (the clue's in the name). Get into the habit of using prepared statements and not putting variables in the sql code. $insert = "UPDATE users SET profile_img = ? WHERE username = ?"; $stmt = $connect->prepare($insert); $stmt->execute( [ $filename, $_SESSION['username'] ] );
  5. Sort the array first. Assuming you start with ... $options = [ [ 'type' => 'Visual disability', 'name' => 'Audio-described cut-scenes' ], [ 'type' => 'Visual disability', 'name' => 'Highlighted path to follow' ], [ 'type' => 'Physical disability', 'name' => 'Sensitivity settings for all the controls' ], [ 'type' => 'Visual disability', 'name' => 'Screen readers on menus' ], [ 'type' => 'Visual disability', 'name' => 'Slow down the game speed' ], ]; then ...
  6. If that is "fixed" then your testing is a little lax. Have you checked if the record is actually being updated (by magic, no doubt, as no query is executed)?
  7. You can store images in a database but it's not advised. Best way is store the image file in the file system and store the image location and metadata in the database.
  8. $this->pdo now contains your pdo connection. so $db = new DB; $stmt = $db->pdo->prepare(...) You should extra code to your class to set the connection's charset (UTF-8) and to set PDO::ATTR_EMULATE_PREPARES to false. It's also useful to set the PDO::ATTR_DEFAULT_FETCH_MODE attribute also.
  9. Change to $id = $_GET['id'] ?? DEFAULT_ID;
  10. Probably because the inner loop's result object is overwriting the outer result object as you store them both in $query. But don't run queries inside loops like that . Use a single query with a join to get all the data in a single query. It's far more efficient. SELECT faqc_name , faq_id , faq_question FROM faq_cats c JOIN faqs f ON f.faq_cat = c.faqc_id WHERE faqc_site = :site ORDER BY faqc_id , faq_id
  11. PHP has array_product(). EG echo array_product([1, 2, 3, 8]); // 48 If you want to be able to supply separate arguments to a function instead of an array EG echo mul(1, 2, 3, 2, 4); then you can define the function as function mul(...$a) { return array_product($a); } echo mul(3,8,2); //48 echo mul(1,2,3,2,2,2) //48
  12. https://lmgtfy.app/?q=Epidemiology+Databases
  13. All you need is $insert_array = [ 'site_name' => 'asdfasdf', 'site_address' => 'Asdffads', 'description' => 'Asdfs', 'contact_phone' => 'Asdfsdaf' ]; $stmt = $conn->prepare("INSERT INTO Sites (site_name, site_address, description, contact_phone) VALUES (:site_name, :site_address, :description, :contact_phone) "); $stmt->execute($insert_array);
  14. One way would be to rename your input fields to something like name = 'jour[$jour][workday]' name = 'jour[$jour][startTime]' name = 'jour[$jour][endTime]' your posted data will then be nicely grouped Array ( [jour] => Array ( [1] => Array ( [workday] => 01/12/2020 [startTime] => 08:00 [endTime] => 06:00 ) [2] => Array ( [workday] => 02/12/2020 [startTime] => 08:30
  15. You are calculating the rank out of the whole population, not just the class. You need to include the class (armslevelid) in the groupings giving EDIT -- use code tags (<> button)
×
×
  • 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.