Jump to content

wongle

Members
  • Posts

    26
  • Joined

  • Last visited

Recent Profile Visitors

1,287 profile views

wongle's Achievements

Member

Member (2/5)

1

Reputation

3

Community Answers

  1. I came on here for some help, not to have the **** taken out of me. This forum was friendly at first.
  2. Hi All, I am trying to copy one table entry from table a to table b and the script that I have written keeps failing and I'm not sure why. E.G. - I have John Smith with contacts table ID 223 and want to copy his details from db1 to db2. It just keeps telling me that there is no connection to the database. The credentials are working fine as they are working on another script. PDOException is not picking up any issues and vardump does not show anything on the page. The databases are on the same server. Code try { $pdo = new PDO('mysql:host=' . db_host . ';dbname=' . db_name . ';charset=' . db_charset, db_user, db_pass); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $data = json_decode($_POST['array']); // $id = isset($_GET['id']) && !empty($_GET['id']) && $_GET['id'] != 'auto' ? $_GET['id'] : NULL; // $name = $_GET['name']; // $last_name = $_GET['last_name']; // $status = 'referral'; $status = 'referral'; $learner_id = $data->learner_id; $name = $data->learner_id; $email = $data->email; $phone = $data->phone; $title = $data->title; $created = $data->created; $status = $data->status; $riskdv = $data->riskdv; $nin = $data->nin; $dob = $data->dob; $nextofkin = $data->nextofkin; $address = $data->address; $refname = $data->refname; $refagency = $data->refagency; $refadd = $data->refadd; $refemail = $data->refemail; $refnum = $data->refnum; $riskvoi = $data->riskvoi; $riskar = $data->riskar; $risksat = $data-risksat; $riskpph = $data-riskpph; $riskpmh = $data->riskpmh; $refpos = $data->riskpos; $mentalhealth = $data->mentalheath; $hisdrug = $data->hisdrug; $exoff = $data->exoff; $learndif = $data->learndif; $hisalc = $data->hisalc; $fled = $data->fled; $rousl = $data->rousl; $trave = $data->trave; $yplc = $data->yplc; $psd = $data->psd; $hivaids = $data->hivadids; $hep = $data->hep; $phyneeds = $data->phyneeds; $mentneeds = $data->mentneeds; $meds = $data->meds; $subdose = $data->subdose; $methmil = $data->methmil; $alcdepend = $data->alcdepend; $ivdrug = $data->ivdrug; $onmeth = $data->onmeth; $compdetox = $data->compdetox; $drugdepend = $data->drugdepend; $dip = $data->dip; $attcdp = $data->attcdp; $heroin = $data->heroin; $canna = $data->canna; $meth = $data->meth; $coc = $data->coc; $crack = $data->crack; $solvents = $data->solvents; $amph = $data->amph; $spice = $data->spice; $premed = $data->premed; $halluc = $data->halluc; $subu = $data->subu; $alclevel = $data->alchevel; $otherinfo = $data->otherinfo; $btype = $data->btype; $bamount = $data->bamount; $bstartdate = $data->bstartddate; $bnextpay = $data->bnextpay; $padd1 = $data->padd1; $padd2 = $data->padd2; $preoff = $data->preoff; $pendcase = $data->pendcase; $precon = $data->precon; $onprob = $data->onprob; $shop = $data->shop; $cook = $data->cook; $money = $data->money; $cleaning = $data->cleaning; $perh = $data->perh; $housing_benefit_claim_date = $data->housing_benefit_claim_date; $housing_benefit_reference = $data->housing_benefit_reference; $housing_benefit_cancelled = $data->housing_benefit_cancelled; $date_left_left = $data->date_left_left; $number_of_times_at_reflections = $data->number_of_times_at_reflections; $amount_of_service_charge_owed = $data->amount_of_service_charge_owed; $reason_for_leaving = $data->reason_for_leaving; $home_town = $data->home_town; $town_moved_to = $data->town_moved_to; $imageSave = $data->imagesave; $datemovedin = $data->datemovedin; $gp_surgery = $data->gpsurgery; $rflfull = $data->rflfull; $last_date_left = $data->last_date_left; $med_cons = $data->med_cons; $addinfo = $data->addinfo; $compldetox = $data->compldetox; $complprog = $data->complprog; $dietaryreq = $data->dietaryreq; // Update the record $stmt = $pdo->prepare('INSERT INTO contacts VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'); $result = $stmt->execute([null,$name,$email,$phone,$title,$created,$status,$riskdv,$nin,$dob,$nextofkin,$address,$refname,$refagency,$refadd,$refemail,$refnum,$riskvoi,$riskar,$risksat,$riskpph,$riskpmh,$refpos, $mentalhealth,$hisdrug,$exoff,$learndif,$hisalc,$fled,$rousl,$trave,$yplc,$psd,$hivaids,$hep,$phyneeds,$mentneeds,$meds,$subdose,$methmil,$alcdepend,$ivdrug,$onmeth,$compdetox,$drugdepend,$dip,$attcdp,$heroin,$canna,$meth,$coc,$crack,$solvents,$amph,$spice,$premed,$halluc,$subu,$alclevel,$otherinfo,$btype,$bamount,$bstartdate,$bnextpay,$padd1,$padd2,$preoff,$pendcase,$precon,$onprob,$shop,$cook,$money,$cleaning,$perh,$housing_benefit_claim_date,$housing_benefit_reference,$housing_benefit_cancelled, $date_left_left, $number_of_times_at_reflections, $amount_of_service_charge_owed, $reason_for_leaving , $home_town, $town_moved_to, $imageSave,$datemovedin,$gp_surgery,$rflfull,$last_date_left,$med_cons,$addinfo,$compldetox,$complprog,$dietaryreq]); var_dump($name); echo "Contact added at Kenobi"; } catch (PDOException $exception) { // If there is an error with the connection, stop the script and display the error. exit('Failed to connect to database!'); } ?> Many thanks, Wongle.
  3. Managed to fix this; $stmt = $pdo->prepare('SELECT * FROM contacts where mentor = ?'); $stmt->execute([$account['id']]); $mentors = $stmt->fetchAll(PDO::FETCH_ASSOC); Also defined $fullcontactinfo to $mentors correctly (hold head down in shame lol) Thank you all for your help
  4. Try using uniqid() in your path name. Mine looks like this - $path = $folder . uniqid().$image ;
  5. Hi there, I am trying to view a list of customers that are currently assigned to my by my login ID (or a users login ID) in the database and view them in a list. Nothing is displaying in the list. Here is what I have written so far. $stmt = $pdo->prepare('SELECT id, username,email,role FROM accounts WHERE id = ?'); $stmt->execute([$_SESSION['id']]); $account = $stmt->fetch(PDO::FETCH_ASSOC); if(isset($_POST['submit'])){ $stmt = $pdo->prepare('SELECT * FROM contacts where mentor = ?'); $stmt->execute([$account['id']]); $mentor = $stmt->fetchAll(PDO::FETCH_ASSOC); } Table - contacts Column name - mentor - stores user ID from accounts table Table - accounts Column name - id Table to view clients <table class="table table-sm table-hover" id="myTable"> <tr class="header"> <th scope="col">Name</th> <th scope="col">Mobile</th> <th scope="col">Date of Birth</th> <th scope="col">Status</th> <th scope="col">Photo</th> <th>Action</th> </tr> <?php if($fullContactInfo == null){ echo "<tr><td>No Record Found!</td></tr>"; }else{ foreach($mentor as $info){ ?> <tr> <td><?php echo $info['name']; ?> <?php echo $info['last_name']; ?></td> <td><?php echo $info['mobile_number']; ?></td> <td><?php $date = $info['dob']; $bits = explode('-', $date); $date = $bits[2] . '/' . $bits[1] . '/' . $bits[0]; echo $date; ?></td> <td><?php echo $info['status']; ?></td> <td><img src="<?php echo $info['image']; ?>" alt="" style="height: 30px; width:30px;"></td> <td> <a href="display.php?id=<?=$info['id']?>"><i class="fa fa-eye" aria-hidden="true"></i></a> <a href="update.php?id=<?=$info['id']?>"><i class="fas fa-pencil-alt"></i></a> </td> </tr> <?php } } ?> </table> I var_dump of $accounts shows the account information as required and a dump of $mentor shows NULL Any help would gratefully be appreciated. Cheers.
  6. Hi there, I am trying to create a script to upload an electronic signature to the a customers record but keep getting ID but does not create the entry on the database and no error messages are produced in the logs, simply refreshes the page. Here is what I have so far. Code <?php include '../../main.php'; check_loggedin($pdo); $msg = null; $date = new DateTime(); $totay_date = $date->format('Y-m-d\TH:i:s'); $folderPath = "upload/"; $image_parts = explode(";base64,", $_POST['signature']); $image_type_aux = explode("image/", $image_parts[0]); $image_type = $image_type_aux[1]; $image_base64 = base64_decode($image_parts[1]); $file = $folderPath . $name . "_" . uniqid() . '.' . $image_type; file_put_contents($file, $image_base64); if (isset($_GET['id'])) { $stmt = $pdo->prepare('SELECT * FROM contacts WHERE id = ?'); $stmt->execute([$_GET['id']]); $contact = $stmt->fetch(PDO::FETCH_ASSOC); $stmt = $pdo->prepare('SELECT id,username FROM accounts'); $stmt->execute(); $all_account_info = $stmt->fetchAll(PDO::FETCH_ASSOC); if(isset($_POST['$name']) == null || isset($_POST['$file'])){ $msg = ''; }else{ $id = isset($_POST['id']) && !empty($_POST['id']) && $_POST['id'] != 'auto' ? $_POST['id'] : auto; $stmt = $pdo->prepare('INSERT INTO esign VALUES (?, ?, ?, ?)'); $result = $stmt->execute([$id, $_GET['id'], $_POST['name'], $_POST['$file']]); $msg = "Signature has been recorded."; } if (!$contact) { exit('Help'); } } else { exit('No ID specified!'); } ?> Form <form action="add-sig.php?id=<?=$contact['id']?>" method="post"> <h1>Signature Pad</h1> <div class="col-md-12"> <label class="form-label" for="name">Name</label> <input class="form-control" id="name" name="name" required="" type="text"> </div> <div class="col-md-12"> <label class="" for="">Signature:</label><br> <div id="sig"></div><br> <textarea id="signature64" name="signature" style="display: none"></textarea> <div class="col-12"> <button class="btn btn-sm btn-warning" id="clear">&#x232B;Clear Signature</button> </div> </div><br> <button class="btn btn-success" name="submit" type="submit">Submit</button> </form> </div> Database `id` int(11) NOT NULL, `client_id` int(11) NOT NULL, `name` varchar(100) NOT NULL, `signature_img` varchar(255) NOT NULL It loads the ID when clicking add signature and the address link looks something like add-sig.php?id=29 when accessing the page from the clients record page. When I am in the clients record, I would like to be able to view the signature on their record. The form converts the signature into an image file. I am scratching my head in what's wrong with the script. Any advice would be greatly appreciated. Cheers.
  7. Thanks for this, really helped me out a lot. I forgot to add the first part to the code; if (isset($_GET['id'])) { $stmt = $pdo->prepare('SELECT * FROM contacts WHERE id = ?'); $stmt->execute([$_GET['id']]); $contact = $stmt->fetch(PDO::FETCH_ASSOC); if (!$contact) { exit('Contact doesn\'t exist with that ID!'); and found that the below code works fine $learning_opportunities = isset($_POST['learning_opportunities']) ? "yes" : "no"; Having taken onboard your advise, I am going to rewrite this form over the weekend, have you got any good tutorial links please for what you mentioned above please?
  8. We are getting a new system next year and that's something that will get addressed - thanks for the advice.
  9. Thanks for your reply, my full code is; $housing_situation_transport_childcare = isset($_POST['housing_situation_transport_childcare']) ? $_POST['housing_situation_transport_childcare'] : $contact['housing_situation_transport_childcare']; $personal_goals = isset($_POST['personal_goals']) ? $_POST['personal_goals'] : $contact['personal_goals']; $currently_spend_time = isset($_POST['currently_spend_time']) ? $_POST['currently_spend_time'] : $contact['currently_spend_time']; $skills_training = isset($_POST['skills_training']) ? $_POST['skills_training'] : $contact['skills_training']; $personal_strengths = isset($_POST['personal_strengths']) ? $_POST['personal_strengths'] : $contact['personal_strengths']; $current_living_situation = isset($_POST['current_living_situation']) ? $_POST['current_living_situation'] : $contact['current_living_situation']; // programme completion & progression $learning_actual_end_date = isset($_POST['learning_actual_end_date']) ? $_POST['learning_actual_end_date'] : $contact['learning_actual_end_date']; $partcipant_complete_course = isset($_POST['partcipant_complete_course']) ? $_POST['partcipant_complete_course'] : $contact['partcipant_complete_course']; $withdrawal_reason = isset($_POST['withdrawal_reason']) ? $_POST['withdrawal_reason'] : $contact['withdrawal_reason']; $participant_intended_learning = isset($_POST['participant_intended_learning']) ? $_POST['participant_intended_learning'] : $contact['participant_intended_learning']; $pcp_education = isset($_POST['pcp_education']) ? $_POST['pcp_education'] : $contact['pcp_education']; $coursestart_date = isset($_POST['coursestart_date']) ? $_POST['coursestart_date'] : $contact['coursestart_date']; $education_provider_name = isset($_POST['education_provider_name']) ? $_POST['education_provider_name'] : $contact['education_provider_name']; $course_title = isset($_POST['course_title']) ? $_POST['course_title'] : $contact['course_title']; $course_level = isset($_POST['course_level']) ? $_POST['course_level'] : $contact['course_level']; $planned_glh = isset($_POST['planned_glh']) ? $_POST['planned_glh'] : $contact['planned_glh']; $in_paid_employment = isset($_POST['in_paid_employment']) ? $_POST['in_paid_employment'] : $contact['in_paid_employment']; $in_paid_employment_start_date = isset($_POST['in_paid_employment_start_date']) ? $_POST['in_paid_employment_start_date'] : $contact['in_paid_employment_start_date']; $in_paid_employer_name_address = isset($_POST['in_paid_employer_name_address']) ? $_POST['in_paid_employer_name_address'] : $contact['in_paid_employer_name_address']; $in_paid_job_title = isset($_POST['in_paid_job_title']) ? $_POST['in_paid_job_title'] : $contact['in_paid_job_title']; $in_paid_contracted_hour = isset($_POST['in_paid_contracted_hour']) ? $_POST['in_paid_contracted_hour'] : $contact['in_paid_contracted_hour']; $not_in_paid_employment = isset($_POST['not_in_paid_employment']) ? $_POST['not_in_paid_employment'] : $contact['not_in_paid_employment']; $pcp_gap_year = isset($_POST['pcp_gap_year']) ? $_POST['pcp_gap_year'] : $contact['pcp_gap_year']; $pcp_others = isset($_POST['pcp_others']) ? $_POST['pcp_others'] : $contact['pcp_others']; $pcp_voluntary_work = isset($_POST['pcp_voluntary_work']) ? $_POST['pcp_voluntary_work'] : $contact['pcp_voluntary_work']; $destination_progression_date = isset($_POST['destination_progression_date']) ? $_POST['destination_progression_date'] : $contact['destination_progression_date']; $destination_progression_collection_date = isset($_POST['destination_progression_collection_date']) ? $_POST['destination_progression_collection_date'] : $contact['destination_progression_collection_date']; $project_officer_name = isset($_POST['project_officer_name']) ? $_POST['project_officer_name'] : $contact['project_officer_name']; $project_officer_signature = isset($_POST['project_officer_signature']) ? $_POST['project_officer_signature'] : $contact['project_officer_signature']; $project_officer_date = isset($_POST['project_officer_date']) ? $_POST['project_officer_date'] : $contact['project_officer_date']; $participant__name = isset($_POST['participant__name']) ? $_POST['participant__name'] : $contact['participant__name']; $participant__signature = isset($_POST['participant__signature']) ? $_POST['participant__signature'] : $contact['participant__signature']; $participant__date = isset($_POST['participant__date']) ? $_POST['participant__date'] : $contact['participant__date']; $final_assessment_progress_you_made = isset($_POST['final_assessment_progress_you_made']) ? $_POST['final_assessment_progress_you_made'] : $contact['final_assessment_progress_you_made']; $final_assessment_progress_your_goal = isset($_POST['final_assessment_progress_your_goal']) ? $_POST['final_assessment_progress_your_goal'] : $contact['final_assessment_progress_your_goal']; $final_assessment_progress_your_reach_goal = isset($_POST['final_assessment_progress_your_reach_goal']) ? $_POST['final_assessment_progress_your_reach_goal'] : $contact['final_assessment_progress_your_reach_goal']; $final_assessment_progress_overall = isset($_POST['final_assessment_progress_overall']) ? $_POST['final_assessment_progress_overall'] : $contact['final_assessment_progress_overall']; $final_assessment_participat_name = isset($_POST['final_assessment_participat_name']) ? $_POST['final_assessment_participat_name'] : $contact['final_assessment_participat_name']; $final_assessment_participat_signature = isset($_POST['final_assessment_participat_signature']) ? $_POST['final_assessment_participat_signature'] : $contact['final_assessment_participat_signature']; $final_assessment_participat_date = isset($_POST['final_assessment_participat_date']) ? $_POST['final_assessment_participat_date'] : $contact['final_assessment_participat_date']; $final_assessment_project_worker_name = isset($_POST['final_assessment_project_worker_name']) ? $_POST['final_assessment_project_worker_name'] : $contact['final_assessment_project_worker_name']; $final_assessment_project_worker_signature = isset($_POST['final_assessment_project_worker_signature']) ? $_POST['final_assessment_project_worker_signature'] : $contact['final_assessment_project_worker_signature']; $final_assessment_project_worker_date = isset($_POST['final_assessment_project_worker_date']) ? $_POST['final_assessment_project_worker_date'] : $contact['final_assessment_project_worker_date']; // ----------- $contact['learning_opportunities'] = isset($_POST['learning_opportunities']) ? "yes" : "no"; $contact_for_other_purposes = isset($_POST['contact_for_other_purposes']); $empowering_communities = isset($_POST['empowering_communities']); $empowering_communities_name = isset($_POST['empowering_communities_name']) ? $_POST['empowering_communities_name'] : $contact['empowering_communities_name']; $empowering_communities_sign = isset($_POST['empowering_communities_sign']) ? $_POST['empowering_communities_sign'] : $contact['empowering_communities_sign']; $empowering_communities_date = isset($_POST['empowering_communities_date']) ? $_POST['empowering_communities_date'] : $contact['empowering_communities_date']; $participant_enrolled_onto = isset($_POST['participant_enrolled_onto']) ? $_POST['participant_enrolled_onto'] : $contact['participant_enrolled_onto']; $participant_moved_another_provider = isset($_POST['participant_moved_another_provider']) ? $_POST['participant_moved_another_provider'] : $contact['participant_moved_another_provider']; $participant_eligible_free_school = isset($_POST['participant_eligible_free_school']) ? $_POST['participant_eligible_free_school'] : $contact['participant_eligible_free_school']; $british_passport = isset($_POST['british_passport']) ? $_POST['british_passport'] : $contact['british_passport']; $eec_passport = isset($_POST['eec_passport']) ? $_POST['eec_passport'] : $contact['eec_passport']; $euss_via_home = isset($_POST['euss_via_home']) ? $_POST['euss_via_home'] : $contact['euss_via_home']; $preferred_evidence = isset($_POST['preferred_evidence']) ? $_POST['preferred_evidence'] : $contact['preferred_evidence']; $provide_preferred_evidence = isset($_POST['provide_preferred_evidence']) ? $_POST['provide_preferred_evidence'] : $contact['provide_preferred_evidence']; $option_adoption_vertificate = isset($_POST['option_adoption_vertificate']) ? $_POST['option_adoption_vertificate'] : $contact['option_adoption_vertificate']; $option_driving_licence = isset($_POST['option_driving_licence']) ? $_POST['option_driving_licence'] : $contact['option_driving_licence']; $option_non_eu_passport = isset($_POST['option_non_eu_passport']) ? $_POST['option_non_eu_passport'] : $contact['option_non_eu_passport']; $option_biometric_immigration = isset($_POST['option_biometric_immigration']) ? $_POST['option_biometric_immigration'] : $contact['option_biometric_immigration']; $option_current_immigration = isset($_POST['option_current_immigration']) ? $_POST['option_current_immigration'] : $contact['option_current_immigration']; $option_marriage_civil_partnership = isset($_POST['option_marriage_civil_partnership']) ? $_POST['option_marriage_civil_partnership'] : $contact['option_marriage_civil_partnership']; $option_other_evidence = isset($_POST['option_other_evidence']) ? $_POST['option_other_evidence'] : $contact['option_other_evidence']; $option_nine = isset($_POST['option_nine']) ? $_POST['option_nine'] : $contact['option_nine']; $details_evidence_provided = isset($_POST['details_evidence_provided']) ? $_POST['details_evidence_provided'] : $contact['details_evidence_provided']; $dwp_job_centre_letter = isset($_POST['dwp_job_centre_letter']) ? $_POST['dwp_job_centre_letter'] : $contact['dwp_job_centre_letter']; $confirmation_relevant_organisation = isset($_POST['confirmation_relevant_organisation']) ? $_POST['confirmation_relevant_organisation'] : $contact['confirmation_relevant_organisation']; $self_certification_evidence = isset($_POST['self_certification_evidence']) ? $_POST['self_certification_evidence'] : $contact['self_certification_evidence']; $partcipant_told_support = isset($_POST['partcipant_told_support']) ? $_POST['partcipant_told_support'] : $contact['partcipant_told_support']; $participant_file_completed_remotly = isset($_POST['participant_file_completed_remotly']) ? $_POST['participant_file_completed_remotly'] : $contact['participant_file_completed_remotly']; $declaration_name_please_print = isset($_POST['declaration_name_please_print']) ? $_POST['declaration_name_please_print'] : $contact['declaration_name_please_print']; $declaration_job_title = isset($_POST['declaration_job_title']) ? $_POST['declaration_job_title'] : $contact['declaration_job_title']; $declaration_organisation = isset($_POST['declaration_organisation']) ? $_POST['declaration_organisation'] : $contact['declaration_organisation']; $declaration_signature_date = isset($_POST['declaration_signature_date']) ? $_POST['declaration_signature_date'] : $contact['declaration_signature_date']; $declaration_signature = isset($_POST['declaration_signature']) ? $_POST['declaration_signature'] : $contact['declaration_signature']; // Update the record $stmt = $pdo->prepare('UPDATE contacts SET current_living_situation=?, personal_strengths=?, skills_training=?, currently_spend_time=?,personal_goals=?,housing_situation_transport_childcare=?, learning_actual_end_date=?, partcipant_complete_course=?, withdrawal_reason=?,participant_intended_learning=?,pcp_education=?, coursestart_date=?,education_provider_name=?,course_title=?,course_level=?,planned_glh=?,in_paid_employment=?,in_paid_employment_start_date=?, in_paid_employer_name_address=?,in_paid_job_title=?,in_paid_contracted_hour=?,not_in_paid_employment=?,pcp_gap_year=?, pcp_others=?,pcp_voluntary_work=?,destination_progression_date=?,destination_progression_collection_date=?,project_officer_name=?, project_officer_signature=?,project_officer_date=?,participant__name=?,participant__signature=?,participant__date=?, final_assessment_progress_you_made=?,final_assessment_progress_your_goal=?,final_assessment_progress_your_reach_goal=?, final_assessment_progress_overall=?,final_assessment_participat_name=?,final_assessment_participat_signature=?, final_assessment_participat_date=?,final_assessment_project_worker_name=?,final_assessment_project_worker_signature=?, final_assessment_project_worker_date=?,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 = ?'); $result = $stmt->execute([$current_living_situation,$personal_strengths,$skills_training,$currently_spend_time,$personal_goals, $housing_situation_transport_childcare,$learning_actual_end_date,$partcipant_complete_course,$withdrawal_reason,$participant_intended_learning,$pcp_education, $coursestart_date,$education_provider_name,$course_title,$course_level,$planned_glh,$in_paid_employment,$in_paid_employment_start_date, $in_paid_employer_name_address,$in_paid_job_title,$in_paid_contracted_hour,$not_in_paid_employment,$pcp_gap_year,$pcp_others, $pcp_voluntary_work,$destination_progression_date,$destination_progression_collection_date,$project_officer_name,$project_officer_signature, $project_officer_date,$participant__name,$participant__signature,$participant__date,$final_assessment_progress_you_made, $final_assessment_progress_your_goal,$final_assessment_progress_your_reach_goal,$final_assessment_progress_overall,$final_assessment_participat_name, $final_assessment_participat_signature,$final_assessment_participat_date,$final_assessment_project_worker_name,$final_assessment_project_worker_signature, $final_assessment_project_worker_date,$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, $_POST['id']]); if($result == true){ $details = "<b>All Data Updated</b>"; // Insert new record into the contacts table $stmt = $pdo->prepare('INSERT IGNORE INTO client_activity (id,client_id,date,time,details,username) VALUES (?,?,?,?,?,?)'); $client_activity = $stmt->execute([ null,$_POST['id'],date("Y/m/d"),date("H:i:s"),$details,$_SESSION['name'] ]); if($client_activity == true){ $msg = 'Updated Successfully!'; }else{ $msg = "Something Missing with Client Activity."; } } else{ $msg = "Something Missing. Information is not updated!"; } }
  10. I have only shortened them to make them easier to read. There is 30 in each.
  11. Yes an entry was logged for access denied to the database using wrong password.
  12. The error logs log everything, but can't see anything for the page in question.
  13. My code for the error reporting is but has never worked try { $pdo = new PDO('mysql:host=' . db_host . ';dbname=' . db_name . ';charset=' . db_charset, db_user, db_pass); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (\PDOException $e) { throw new \PDOException($e->getMessage(), (int)$e->getCode()); // If there is an error with the connection, stop the script and display the error. exit('Failed to connect to database!'); }
  14. I am having issues when I untick a checkbox and leave it blank and update my PHP / MySQL form, the data is not saved in the database. Updates text / date fields are working fine. Code (The prepare and execute statements have been shorten for easier reading) $learning_opportunities = isset($_POST['learning_opportunities']) ? $_POST['learning_opportunities'] : $contact['learning_opportunities']; $stmt = $pdo->prepare('UPDATE contacts SET current_living_situation=?, learning_opportunities=?,contact_for_other_purposes=?, where id = ?'); $result = $stmt->execute([$current_living_situation,$personal_strengths,$learning_opportunities,$declaration_organisation,$declaration_signature_date, $declaration_signature, $_POST['id']]); if($result == true){ $details = "<b>All Data Updated</b>"; // Insert new record into the contacts table $stmt = $pdo->prepare('INSERT IGNORE INTO client_activity (id,client_id,date,time,details,username) VALUES (?,?,?,?,?,?)'); $client_activity = $stmt->execute([ null,$_POST['id'],date("Y/m/d"),date("H:i:s"),$details,$_SESSION['name'] ]); if($client_activity == true){ $msg = 'Updated Successfully!'; Form code <input type="checkbox" name="learning_opportunities" value="learning_opportunities" <?php if($contact['learning_opportunities']=="Yes"){ echo 'checked'; } ?>> About courses or learning opportunities.<br> If I change the variable the below, it allows me to uncheck the box, but not select it again $learning_opportunities = isset($_POST['learning_opportunities']); I have read countless articles and tutorials and can't get it to update the data. Any help or advise would be much appreciated.
  15. Sorted - Y-m-d\TH:i:s Now working fine Thanks for your help guys
×
×
  • 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.