zishan0215 / attendance

Attendance Management System for Computer Departement, JMI
Other
42 stars 130 forks source link

Admin->Teachers->Edit Teacher: Issues #16

Closed zishan0215 closed 10 years ago

zishan0215 commented 10 years ago

@nkmittal4994 Lets talk about this here

zishan0215 commented 10 years ago

yes.. teacher_id should be given there

nickedes commented 10 years ago

hm :P

nickedes commented 10 years ago

listen!

zishan0215 commented 10 years ago

yes

nickedes commented 10 years ago

when i will write a function for updating in subject_m ...den i will update both times by dat only na?

nickedes commented 10 years ago

or a different func in teacher_m too ?

zishan0215 commented 10 years ago

no ! you don't need a method for teacher.. that can be done using save(). A new method is only required for updating the subject values

nickedes commented 10 years ago

oka! :+1:

nickedes commented 10 years ago

so basically i will update d values of subject table corresponding to the teacher_id ?

zishan0215 commented 10 years ago

yes

nickedes commented 10 years ago

update query

$query = 'UPDATE subject SET subject_code = ' . "'" . $data['subject_code'] . "'" . ' WHERE teacher_id' = . "'" . $id . "'";

zishan0215 commented 10 years ago

you dont need to enclose $id in quotes... its an integer

zishan0215 commented 10 years ago

include the rest of the fields as well.. eg. subject_name.. etc

nickedes commented 10 years ago

ok

nickedes commented 10 years ago

rest of the fields separated by comma n like dis only

zishan0215 commented 10 years ago

yes

nickedes commented 10 years ago
$query = 'UPDATE subject SET subject_code = ' . "'" . $data['subject_code'] . "'" . "','" . 'subject_name ' =  . "'" . $data['subject_name'] . "'" . "','" .'semester ' =  . "'" . $data['semester'] . "'" .' WHERE teacher_id' = . $id ;

likhi toh h kuch

zishan0215 commented 10 years ago

semester main bhi you dont need quotes

nickedes commented 10 years ago

but it says der is an error in query :( and i removed those quotes

nickedes commented 10 years ago

Parse error: syntax error, unexpected '=' in E:\xampp\htdocs\jmiams\application\models\subject_m.php on line 41

tusharaheja commented 10 years ago

@nkmittal4994 your query seems to be a lot confusing with the use of double and single quotes.....and the equal sign(after the subject_name) is definitely not positioned correctly....try using this $query = 'UPDATE subject SET subject_code = ' . $data['subject_code'] . ', subject_name = ' . $data['subject_name'] .', semester = ' . $data['semester'] . ' WHERE teacher_id =' . $id ;

nickedes commented 10 years ago

@tusharaheja thnx. i corrected it earlier though. but double quotes needs to be der for values dat are of string type.

zishan0215 commented 10 years ago

@tusharaheja that query won't work because the string values have not been enclosed in quotes.. As said by $nkmittal4994 you need quotes around such values and this makes the query a little confusing.