Jump to content

EarthDay

Members
  • Posts

    42
  • Joined

  • Last visited

EarthDay's Achievements

Member

Member (2/5)

0

Reputation

2

Community Answers

  1. Hi there, I have a ACR122U NFC card reader and would like to use it to login to my PHP login system. The site is on a hosted VPS and the card reader is on a local PC. Any advise? Many thanks, ED.
  2. Hi there The outputs are string(3) "252" string(3) "151" which are correct. I thought it was an issue with the client_id and put in there for testing purposes. Will be removed when fixed.
  3. Hi there, I have full error reporting on in my test environment but is not producing any error reports. I've tried a VARDUMP and comes back with; array(34) { ["id"]=> string(3) "151" ["learning_opportunities"]=> string(2) "No" ["contact_for_other_purposes"]=> string(5) "Phone" ["empowering_communities"]=> string(2) "No" ["empowering_communities_name"]=> string(22) "David Testffffffffffff" ["empowering_communities_sign"]=> string(9) "Dave Test" ["empowering_communities_date"]=> string(10) "2023-10-10" ["participant_enrolled_onto"]=> string(2) "No" ["participant_moved_another_provider"]=> string(2) "No" ["participant_eligible_free_school"]=> string(2) "No" ["british_passport"]=> string(3) "Yes" ["eec_passport"]=> string(2) "No" ["euss_via_home"]=> string(2) "No" ["preferred_evidence"]=> string(3) "Yes" ["provide_preferred_evidence"]=> string(9) "345345353" ["option_adoption_vertificate"]=> string(0) "" ["option_driving_licence"]=> string(0) "" ["option_non_eu_passport"]=> string(0) "" ["option_biometric_immigration"]=> string(0) "" ["option_current_immigration"]=> string(0) "" ["option_marriage_civil_partnership"]=> string(0) "" ["option_other_evidence"]=> string(0) "" ["option_nine"]=> string(35) "Utility Bill/Phone Bill/Council Tax" ["details_evidence_provided"]=> string(7) "sdghsdf" ["dwp_job_centre_letter"]=> string(0) "" ["confirmation_relevant_organisation"]=> string(0) "" ["self_certification_evidence"]=> string(3) "fff" ["partcipant_told_support"]=> string(3) "Yes" ["participant_file_completed_remotly"]=> string(2) "No" ["declaration_name_please_print"]=> string(7) "gdfgsdg" ["declaration_job_title"]=> string(8) "sdfgsdfg" ["declaration_organisation"]=> string(8) "sdfgsdfg" ["declaration_signature_date"]=> string(10) "2023-10-10" ["declaration_signature"]=> string(6) "dfgshf" } string(69) "No rows updated. Possible reasons: No changes detected or invalid ID." Cheers, ED.
  4. Hi there, I am trying to get an update form to work and it does not save the information to the database. My link to update a record is forms/decs-update.php?id=<?=$contact['id']?>&decs_id=<?=$decs['id']?> The information loads on the page from the diabase but does not save the information to the database and give me an error message; No rows updated. Possible reasons: No changes detected or invalid ID. <?php include '../../main.php'; check_loggedin($pdo); $msg = ''; ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); if (!isset($_GET['id'])) { exit('No ID parameter provided!'); } $stmt = $pdo->prepare('SELECT username,email,role FROM accounts WHERE id = ?'); $stmt->execute([ $_SESSION['id'] ]); $account = $stmt->fetch(PDO::FETCH_ASSOC); $stmt = $pdo->prepare('SELECT id,username FROM accounts'); $stmt->execute(); $all_account_info = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt = $pdo->prepare('SELECT * FROM contacts WHERE id = ?'); $stmt->execute([$_GET['id']]); $contact = $stmt->fetch(PDO::FETCH_ASSOC); $Rstmt = $pdo->prepare('SELECT * FROM esf_decs WHERE id = ?'); $Rstmt->execute([$_GET['decs_id']]); $decs = $Rstmt->fetch(PDO::FETCH_ASSOC); if (!$contact) { exit('Contact doesn\'t exist with that ID!'); } if ($_SERVER['REQUEST_METHOD'] === 'POST') { try { $client_id = trim($_POST["client_id"]); $learning_opportunities = trim($_POST["learning_opportunities"]); $learning_opportunities = trim($_POST["learning_opportunities"]); $contact_for_other_purposes = trim($_POST["contact_for_other_purposes"]); $empowering_communities = trim($_POST["empowering_communities"]); $empowering_communities_name = trim($_POST["empowering_communities_name"]); $empowering_communities_sign = trim($_POST["empowering_communities_sign"]); $empowering_communities_date = trim($_POST["empowering_communities_date"]); $participant_enrolled_onto = trim($_POST["participant_enrolled_onto"]); $participant_moved_another_provider = trim($_POST["participant_moved_another_provider"]); $participant_eligible_free_school = trim($_POST["participant_eligible_free_school"]); $british_passport = trim($_POST["british_passport"]); $eec_passport = trim($_POST["eec_passport"]); $euss_via_home = trim($_POST["euss_via_home"]); $preferred_evidence = trim($_POST["preferred_evidence"]); $provide_preferred_evidence = trim($_POST["provide_preferred_evidence"]); $option_adoption_vertificate = trim($_POST["option_adoption_vertificate"]); $option_driving_licence = trim($_POST["option_driving_licence"]); $option_non_eu_passport = trim($_POST["option_non_eu_passport"]); $option_biometric_immigration = trim($_POST["option_biometric_immigration"]); $option_current_immigration = trim($_POST["option_current_immigration"]); $option_marriage_civil_partnership = trim($_POST["option_marriage_civil_partnership"]); $option_other_evidence = trim($_POST["option_other_evidence"]); $option_nine = trim($_POST["option_nine"]); $details_evidence_provided = trim($_POST["details_evidence_provided"]); $dwp_job_centre_letter = trim($_POST["dwp_job_centre_letter"]); $confirmation_relevant_organisation = trim($_POST["confirmation_relevant_organisation"]); $self_certification_evidence = trim($_POST["self_certification_evidence"]); $partcipant_told_support = trim($_POST["partcipant_told_support"]); $participant_file_completed_remotly = trim($_POST["participant_file_completed_remotly"]); $declaration_name_please_print = trim($_POST["declaration_name_please_print"]); $declaration_job_title = trim($_POST["declaration_job_title"]); $declaration_organisation = trim($_POST["declaration_organisation"]); $declaration_signature_date = trim($_POST["declaration_signature_date"]); $declaration_signature = trim($_POST["declaration_signature"]); $stmt = $pdo->prepare('UPDATE esf_decs SET client_id=?,learning_opportunities=?,contact_for_other_purposes=?,empowering_communities=?,empowering_communities_name=?,empowering_communities_sign=?,empowering_communities_date=?,participant_enrolled_onto=?,participant_moved_another_provider=?,participant_eligible_free_school=?,british_passport=?,eec_passport=?,euss_via_home=?,preferred_evidence=?,provide_preferred_evidence=?,option_adoption_vertificate=?,option_driving_licence=?,option_non_eu_passport=?,option_biometric_immigration=?,option_current_immigration=?,option_marriage_civil_partnership=?,option_other_evidence=?,option_nine=?,details_evidence_provided=?,dwp_job_centre_letter=?,confirmation_relevant_organisation=?,self_certification_evidence=?,partcipant_told_support=?,participant_file_completed_remotly=?,declaration_name_please_print=?,declaration_job_title=?,declaration_organisation=?,declaration_signature_date=?,declaration_signature=? WHERE id=?'); $stmt->execute([$client_id,$learning_opportunities,$contact_for_other_purposes,$empowering_communities,$empowering_communities_name,$empowering_communities_sign,$empowering_communities_date,$participant_enrolled_onto,$participant_moved_another_provider,$participant_eligible_free_school,$british_passport,$eec_passport,$euss_via_home,$preferred_evidence,$provide_preferred_evidence,$option_adoption_vertificate,$option_driving_licence,$option_non_eu_passport,$option_biometric_immigration,$option_current_immigration,$option_marriage_civil_partnership,$option_other_evidence,$option_nine,$details_evidence_provided,$dwp_job_centre_letter,$confirmation_relevant_organisation,$self_certification_evidence,$partcipant_told_support,$participant_file_completed_remotly,$declaration_name_please_print,$declaration_job_title,$declaration_organisation,$declaration_signature_date,$declaration_signature,$_GET['id']]); if($stmt->rowCount()) { $_SESSION['status'] = "The asset information has been successfully updated."; header('Location: ../display.php?id=' . $_GET['id']); exit; } else { $msg = "No rows updated. Possible reasons: No changes detected or invalid ID."; } } catch (PDOException $e) { $msg = "Error: " . $e->getMessage(); } } ?> <form action="decs-update.php?id=<?=$decs['id']?>" method="post" enctype="multipart/form-data"> Database structure `id` int(11) NOT NULL, `client_id` int(11) DEFAULT NULL, `learning_opportunities` varchar(225) DEFAULT NULL, `contact_for_other_purposes` varchar(100) DEFAULT NULL, `empowering_communities` varchar(50) DEFAULT NULL, `empowering_communities_name` text DEFAULT NULL, `empowering_communities_sign` text DEFAULT NULL, `empowering_communities_date` date DEFAULT NULL, `participant_enrolled_onto` varchar(50) DEFAULT NULL, `participant_moved_another_provider` varchar(50) DEFAULT NULL, `participant_eligible_free_school` varchar(50) DEFAULT NULL, `british_passport` varchar(225) DEFAULT NULL, `eec_passport` varchar(225) DEFAULT NULL, `euss_via_home` varchar(225) DEFAULT NULL, `preferred_evidence` varchar(225) DEFAULT NULL, `provide_preferred_evidence` varchar(225) DEFAULT NULL, `option_adoption_vertificate` varchar(225) DEFAULT NULL, `option_driving_licence` varchar(225) DEFAULT NULL, `option_non_eu_passport` varchar(225) DEFAULT NULL, `option_biometric_immigration` varchar(225) DEFAULT NULL, `option_current_immigration` varchar(225) DEFAULT NULL, `option_marriage_civil_partnership` varchar(225) DEFAULT NULL, `option_other_evidence` varchar(225) DEFAULT NULL, `option_nine` text DEFAULT NULL, `details_evidence_provided` varchar(225) DEFAULT NULL, `dwp_job_centre_letter` varchar(225) DEFAULT NULL, `confirmation_relevant_organisation` varchar(225) DEFAULT NULL, `self_certification_evidence` varchar(225) DEFAULT NULL, `partcipant_told_support` varchar(225) DEFAULT NULL, `participant_file_completed_remotly` varchar(225) DEFAULT NULL, `declaration_name_please_print` varchar(225) DEFAULT NULL, `declaration_job_title` varchar(225) DEFAULT NULL, `declaration_organisation` varchar(225) DEFAULT NULL, `declaration_signature_date` date DEFAULT NULL, `declaration_signature` varchar(225) DEFAULT NULL I can't see the issue anywhere Cheers, ED.
  5. Thanks for the advise @maxxd I have resolved this by adding the amending the code to the following; <?php require_once __DIR__ . "/DataSource.php"; $database = new DataSource(); $rowCount = count($_POST["contacts"]); for ($i = 0; $i < $rowCount; $i ++) { $query = "UPDATE `contacts` SET `status` = 'NoShow' WHERE id=?"; $paramType = "i"; $paramValue = array( $_POST["contacts"][$i] ); $isUpdated = $database->update($query, $paramType, $paramValue); } header("Location:index.php"); exit(); ?> The issue that I am having now is that the I have 3 buttons on the bottom of the page that link to different update options and only 2 of them are working, the 3rd one does nothing; Code on JS Fiddle As far as I know, everything looks right and can't see any reason why it would stop working on the 3rd button. Cheers, ED.
  6. Hi there, I am trying to update a multiple rows for a single column and the code that I have wrote runs through fine and does not show any error messages but does not update the rows or column. <?php require_once __DIR__ . "/DataSource.php"; $database = new DataSource(); $sql = "SELECT * FROM contacts"; $result = $database->select($sql); ?> <html> <head> <title>Users List</title> <link rel="stylesheet" type="text/css" href="css/style.css" /> <link rel="stylesheet" type="text/css" href="css/table.css" /> <script language="javascript" src="function.js" type="text/javascript"></script> </head> <body> <div class="phppot-container"> <h1>Users List</h1> <form name="frmUser" method="post" action=""> <div id="message"><?php if(isset($message)) { echo $message; } ?></div> <table class="striped"> <thead> <tr class="listheader"> <th></th> <th>Username</th> <th>Status</th> </tr> </thead> <?php if (is_array($result) || is_object($result)) { foreach ($result as $i => $value) { if ($i % 2 == 0) $classname = "evenRow"; else $classname = "oddRow"; ?> <tr class="<?php if(isset($classname)) echo $classname;?>"> <td><input type="checkbox" name="contacts[]" value="<?php echo $result[$i]["id"]; ?>"></td> <td><?php echo $result[$i]["name"]; ?></td> <td><?php echo $result[$i]["status"]; ?></td> </tr> <?php $i ++; } } ?> <tr> <td colspan="4"><input type="button" name="update" value="Update" onClick="setUpdateAction();" /> <input type="button" name="delete" value="Delete" onClick="setDeleteAction();" /></td> </tr> </table> </form> </div> </body> </html> update.php <?php require_once __DIR__ . "/DataSource.php"; require_once __DIR__ . "/DataSource.php"; $database = new DataSource(); $rowCount = count($_POST["contacts"]); for ($i = 0; $i < $rowCount; $i ++) { $query = "UPDATE contacts SET status = InProgress WHERE id=?"; $paramType = "i"; $paramValue = array( $_POST["users"][$i] ); } header("Location:index.php"); exit(); ?> Any help would greatly be apprciated. Cheers, ED.
  7. This link should help you to enable "Remember Me" Link
  8. Hi there, I was wondering if someone could point me in the right direction please? I am trying to alter my CRUD view table by adding a check box to the row and using a drop down menu to update a field in the database for multiple records. Say that a client has a status of referral and I want to change multiple clients to In Progress, I want to be able to select the clients and use the drop down menu to update the status. Any help would greatly be appreciated. Thanks, ED.
  9. Have you got any sample code you can share?
  10. It checks to see if the ID exists in in cic_kenobi.
  11. So if the ID exists in the new database, it does not get overwritten.
  12. Hi Kicken, Thank you for your reply, I have just edited my post Cheers, ED.
  13. Hi there, I have wrote a script to copy client data over from our old system to the new system and it's giving me the above error message. I know the script is not very secure but it's located on the internal network and is not open to the internet via firewall rules. I am monitoring use of the script very closely (When I get it working lol) Full error message I have gone through the code and everything appears to be correct and can't seem to see what the problem is. Both tables are the same and using the same version of PHP 8.2 and are located on the same server. I know that I can just export and import but we are manually reviewing what information goes over and this is the easiest way for us to do it. Code; <?php $databaseHost = 'localhost'; $databaseName = ''; $databaseUsername = ''; $databasePassword = ''; $mysqli = mysqli_connect($databaseHost, $databaseUsername, $databasePassword, $databaseName); $id = $_GET['id']; $sql="select from cic_remus.contacts where (id='$id');"; $res=mysqli_query($mysqli,$sql); if (mysqli_num_rows($res) > 0) { // output data of each row $row = mysqli_fetch_assoc($res); if($id==$row['id']) { echo "Already copied"; } } else{ $query=mysqli_query($mysqli,"INSERT INTO cic_kenobi.contacts (status, image, datemovedin, learner_id, title, name, last_name, sex, dob, house_number, address_line_one, address_line_two, city_town, country, postcode, postcode_enrolment, phone, mobile_number, email_address, ethnic_origin, ethnicitys, health_problem, health_disability_problem_if_yes, lldd, education_health_care_plan, health_problem_start_date, education_entry, emergency_contact_details, employment_paid_status, employment_date, unemployed_month, education_training_prior, education_claiming, claiming_if_yes, household_situation, mentor, intext) SELECT status, image, datemovedin, learner_id, title, name, last_name, sex, dob, house_number, address_line_one, address_line_two, city_town, country, postcode, postcode_enrolment, phone, mobile_number, email_address, ethnic_origin, ethnicitys, health_problem, health_disability_problem_if_yes, lldd, education_health_care_plan, health_problem_start_date, education_entry, emergency_contact_details, employment_paid_status, employment_date, unemployed_month, education_training_prior, education_claiming, claiming_if_yes, household_situation, mentor, intext FROM cic_remus.contacts WHERE id =$id"); echo "Successfully copied"; } ?> If I change the below code to $sql="select from cic_remus.contacts where (id='$id');"; to $sql="select `id` from cic_remus.contacts where (id='$id');"; It gives me the error message that the contact already exists with the same ID and does not create a new ID. Cheers, ED.
  14. Hi Berand, I know it's old code, it's part of a system that is getting upgraded later this year. Thank you for this. It's still showing the the week as w8 and not w08 when trying to go to the previous page. Cheers, ED.
  15. H Barand, I have changed the code slightly to match my older script; if(isset($_GET['selectWeek'])){ $week = $_GET['selectWeek']; $num_week = ltrim($week, 'w0')?? 1; $prev = $num_week - 1; $next = $num_week + 1; if ($prev < 1) $prev = 1; if ($next > 53) $next = 53; The issue that I am having now is giving the below error message; week in database is VARCHAR(50) And the link is showing as The error message is caused by line 18 $prev = $num_week - 1; Links <a class='button' href='?selectWeek=<?=$prev?>'>&lt;</a> <input class='weekno' type='text' name='selectWeek' value='<?=$num_week?>'> Cheers, ED.
×
×
  • 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.