php - CodeIgniter Update function not working? -


I am trying to update a database and change all the rows at once, Amend_job ($ heading, $ description, $ location, $ date, $ time, $ pay, $ jobcat, $ job_id) // This function is amended in a job:

Does. $ {$ AmendJob = array ($ Job, "JobTitle" => $ Title, "Job Description" => $ description, "Job Position" = & gt; $ location, "JobDate" => $ Date, "JobStartTime" => $ Time, "Job" => $ Pay, "JobCategory" = $ Workcat); $ This- & gt; Db- & gt; Where ('JobID', $ job_id); $$ - gt; Update ('hm_jobs', $ amendJob); }

The code does not run with any database or syntax errors, I think the update syntax may be incorrect, any suggestions?

I have updated the above function, here is the controller function:

  function amend_job () {$ this- & gt; Load-> Library ('form_validation'); $ This- & gt; Form_validation- & gt; Set_rules ('title', 'title', 'required | trim | MAX_LENGTH [50] | xss_clean | strip_tags'); $ This- & gt; Form_validation- & gt; Set_rules ('description', 'description', 'required | trim | MAX_LENGTH [200] | xss_clean | strip_tags'); $ This- & gt; Form_validation- & gt; Set_rules ('location', 'location', 'required | trim | MAX_LENGTH [50] | xss_clean | strip_tags'); $ This- & gt; Form_validation- & gt; Set_rules ('date', 'start date', 'required | trim | max_long [20] | xss_clean'); $ This- & gt; Form_validation- & gt; Set_rules ('time', 'time', 'required | trim | MAX_LENGTH [20] | xss_clean'); $ This- & gt; Form_validation- & gt; Set_reales ('pay', 'pay rate', 'required | trim | max_long [[10] | xss_clean | number'); $ This- & gt; Form_validation- & gt; Set_reales ('jobcat', 'job category', 'required | trim | max_long [30] | xss_clean'); If ($ this-> form_validation-> Run () == FALSE) {$ session_data = $ this-> Session-> User data ('log in_in'); $ Data ['username'] = $ session_data ['username']; $ Data ['Username'] = $ session_data ['UsteTech']; $ Data ['id'] = $ session_data ['id']; $ This- & gt; Load-> View ('amend_job_view', $ data); return false; } Other {// sending form input. $$ title = $ this- & gt; Input-> Post ('title'); $ Description = $ this- & gt; Input-> Post ('description'); $ Location = $ this- & gt; Input-> Post ('location'); $ Date = $ this- & gt; Input-> Post ('date'); $ Time = $ this- & gt; Input-> post time'); $ Payment = $ this- & gt; Input-> post payment'); $ Jobcat = $ this- & gt; Input-> Post ('jobcat'); // Sending session data. $$ session_data = $ this- & gt; Session-> User data ('log in_in'); $ Data ['username'] = $ session_data ['username']; $ Data ['Username'] = $ session_data ['UsteTech']; $ Data ['id'] = $ session_data ['id']; $ Job_id = $ this- & gt; Uri-> Section (3); $ This- & gt; Load-> Model ("job_model"); If ($ this-> Jobs_model- & gt; Amendment_Job ($ heading, $ description, $ location, $ date, $ time, $ pay, $ job cache, $ job_id)) {echo $ this- & gt; Db- & gt; Last_query (); / * PHP generates Javascript that shows the details registered with the user. Echo "& lt; script language = \" javascript \ "type = \" text / javascript \ "& gt; \ n"; Echo "warning ('This work has been successfully modified, is returning to your home.'); \ N"; Echo "window.location.href = '(my link)'; "; Closing PHP Generated JavaScript, which shows the details registered with the user. * /} Else {$ data ['msg'] = "There was an error while trying to add this work."; }} $ This-> Load-> View ("customer_view", $ data); }  

Now $ job_id is not found and the query is:

  UPDATE `HM_Jobs` SET` JobTitle` = 'dfsdsf',` Job description 'job '=' FDA ', `JobDate' = '2014-01-01', 'JobStart Time' = '02: 00: 00 ',' JobPay '= '32.00', 'Jobcacher' = 'Carpentry / Wood Work 'where' job ID '= 0  

I am using the Yuri segment and the link is as follows: (my site) / handman / index.fip / job-controller / mind_page / 43

You get two IDs in the job Land a $ job_id and $ id . And you're not using $ id anywhere, I think you should check the parameters again and call the function again. You might be mixing these two $ ids.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

lua - HowTo create a fuel bar -