Closed zishan0215 closed 9 years ago
hi
haan to remove button ko code kar ke liye you need to know the fact that teacher_id cannot be empty
ok
its a simple process.. just update the subjects table and put teacher_id = 0
ek min mujhe kuch cheezen poochni hain
why increment option on edit student
har semester over hone ke baad semester increment ho jaata hai students ka
usse code kaise kiya ??
main to main cheez daali thi
submit krne ke baad ussi page par khul jata hai isse code kaise kiya?
dekhlo code main... subject_m main hai
just a query to increment the semester
yeh kya krta hai
har student ka semester increment kar deta hai by 1
if($this->student_m->save($array,$this->data['student_id'])) { $this->data['confirmation'] = 1; } else { $this->data['confirmation'] = 2; }
yeh kya kr rha hai??
ye confirmation set kar raha hai.. agar update sahi hua to cofirmation positive hogi else negative
student_m mein sirf update name kiya hai semester kyu nhi kiya??
are you alright sahil? you have the new code so you can see yourself ki use code kaise kiya gaya..!!!
public function update_semester() {
$query = 'UPDATE student set semester = semester + 1';
$q =$this->db->query($query);
return $q;
}
ye hai query
sahil for increment semester i just incremented the values of semester column in student table!
use update query.
acha to ab yeh batao @zishanAhmad ki remove button mein kya kya options dene hain ?
kuch nahi
just remove the subject..(that is put teacher_id) = 0
why 0?
becuase that is what it has to be to unlink from the current teacher
isme remove button ke corresponding subject_id hoga na
tumne teacher_id hidden krke kyu dala hai
nahi.. you only need subject_code to update the teacher_id = 0
haan to subject code save kahan hua hai uss page pr
karlo tum.. remove waale button ka form jo hai.. usme hidden input le lo subject_code ka
tumne usme hidden mein teacher_id liya hai?? iska kya use hai?
that should be subject_code.. change karlo
remove krne ki coding kidhar hogi??
wahi pe.. view_teacher main
usme SQL commands chal jayenge?/
commands to likhi hui hain subject_m main
arre matlab query kahan bnaun ??
controller mein??
just use save
no need to write your own query
where to use save()?
view_teacher main
for eg.. refer to increment semester ...
arre bhai mere jo tum save() wali query hai vo to controlloer mein likhoge na
bhai.. save defined hai my_model main
itni jagah use kara hua hai.. search karo for save and see how it is being used
So lets discuss this here