Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation since 03/21/2024 in all areas

  1. the session.save_path setting in the php.ini is pointing to a now non-existent/non-accessible folder. you need to see of there is already an appropriate folder within your account's directory tree /home/rgxb6tc5wk5q/... for session data files and set the session.save_path setting to point to it, and if a folder doesn't exist, create it and set the session.save_path setting to point to it. when your account was created/moved they should have had templates setup to do this automatically.
    1 point
  2. i recommend that you make a new file with the code necessary to load the phpmailer script and with your sendEmailNotification() function in it, setup some test data, and call the sendEmailNotification() function and get the email to work. once you get the email to work on its own, then make sure that your full code is actually calling the sendEmailNotification() function, by echoing/logging a value at the completion of the email code. you are performing a redirect right after the INSERT query. it's possible that the sms code will take enough time to make the curl request that the browser can abort the current request and halt code execution before your code gets to the email code. it's also possible that the curl code is throwing an error and your code never gets to the email code. any such redirect needs to be at the end of the post method form processing code, it should only occur if there are no user/validation errors, and it should be to the exact same URL of the current page to cause a get request for that page. here's a list of things that will simplify the code, making it easier to see what the code is trying to do - you should only catch and handle database exceptions for user recoverable errors, such as when inserting/updating duplicate user submitted data. for all other insert/update query error numbers, just rethrow the exception and let php handle it and for all other type of queries, let php catch and handle any database exception. for the INSERT query you should be catching and testing for a duplicate index error number. if an applicant can only register once, the applicant_id column should be defined as a unique index, so that only one record per applicant_id can be inserted. if an applicant can only register for a single exam_date_id, the combined applicant_id and exam_date_id columns need to be defined as a composite unique index. if you set the default fetch mode to assoc when you make the database connection, you won't have to specify it in each fetch statement. don't copy variables to other variables for nothing. just use the original variables that data is in.
    1 point
  3. Hi all, My name is Lokesh Joshi and I am new here.
    1 point
  4. If I understood correctly (although I can't see what your data looks like) you may want something like this... TEST DATA TABLE: items TABLE: weapons +----------+--------+ +----+----------+--------+-------+ | playerid | itemid | | id | playerid | weapid | level | +----------+--------+ +----+----------+--------+-------+ | 2 | 2 | | 1 | 2 | 1 | 2 | | 2 | 3 | | 2 | 3 | 1 | 2 | | 2 | 4 | +----+----------+--------+-------+ | 3 | 2 | +----------+--------+ QUERY and RESULTS (Find which players have an item that is 1 greater than current weapon level) SELECT w.playerid , w.weapid , w.level , COALESCE(i.itemid, 'You don\'t have an item for upgrade') as item FROM weapons w LEFT JOIN items i ON w.playerid = i.playerid AND i.itemid = w.level + 1; +----------+--------+-------+------------------------------------+ | playerid | weapid | level | item | +----------+--------+-------+------------------------------------+ | 2 | 1 | 2 | 3 | | 3 | 1 | 2 | You don't have an item for upgrade | +----------+--------+-------+------------------------------------+
    1 point
  5. I find data attributes useful for associating inputs for the same record. I get the data-id of the select field then change other fields with the same data-id. Here's an example <php $employees = [ [ 'id'=>21, 'name'=>'Curly', 'status'=>1, 'title'=>'Sales Manager', 'salary'=>65000 ], [ 'id'=>22, 'name'=>'Larry', 'status'=>1, 'title'=>'Sales Assistant', 'salary'=>45000 ], [ 'id'=>33, 'name'=>'Mo', 'status'=>1, 'title'=>'Sales Assistant', 'salary'=>45000 ], [ 'id'=>46, 'name'=>'Tom', 'status'=>1, 'title'=>'Sales Assistant', 'salary'=>45000 ], [ 'id'=>47, 'name'=>'Dick', 'status'=>1, 'title'=>'Trainee', 'salary'=>25000 ], [ 'id'=>51, 'name'=>'Harry', 'status'=>1, 'title'=>'Trainee', 'salary'=>25000 ] ]; $tdata = ''; foreach ($employees as $e) { $tdata .= "<tr> <td>{$e['name']}</td> <td><select name='emp[{$e['id']}][status]' class='status' data-id='{$e['id']}'>" . statusOptions($e['status']) . "</td> <td><input type='text' name='emp[{$e['id']}][title]' class='title' data-id='{$e['id']}' value='{$e['title']}'></td> <td><input type='text' name='emp[{$e['id']}][salary]' class='salary' data-id='{$e['id']}' value='{$e['salary']}'></td> </tr>"; } function statusOptions($current) { $stats = [1 => "Working", 2 => "Not Working"]; $opts = "<option value=''>- select status -</option>"; foreach ($stats as $s => $desc) { $sel = $s == $current ? 'selected' : ''; $opts .= "<option $sel value='$s'>$desc</option>"; } return $opts; } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Example</title> <script src="https://code.jquery.com/jquery-3.6.4.min.js"></script> <script type='text/javascript'> $(function() { $(".status").change(function() { let id = $(this).data("id") if ( $(this).val() == 2 ) { $(".title[data-id="+id+"]").attr("disabled", true) $(".salary[data-id="+id+"]").attr("disabled", true) } else { $(".title[data-id="+id+"]").attr("disabled", false) $(".salary[data-id="+id+"]").attr("disabled", false) } }) }) </script> <style type='text/css'> table { border-collapse: collapse; width: 80%; margin: 30px auto; } th { text-align: left; padding: 8px; color: white; background-color: black; } td { padding: 4px 8px; } </style> </head> <body> <h1>Example</h1> <form method='POST'> <table border='1'> <tr> <th>Name</th> <th>Status</th> <th>Job Title</th> <th>Salary</th> </tr> <?= $tdata ?> <tr><td colspan='4'><input type='submit'></tr> </table> </form> </body> </html>
    1 point
This leaderboard is set to New York/GMT-04:00
×
×
  • 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.