Closed zishan0215 closed 10 years ago
yes.. teacher_id should be given there
hm :P
listen!
yes
when i will write a function for updating in subject_m ...den i will update both times by dat only na?
or a different func in teacher_m too ?
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
oka! :+1:
so basically i will update d values of subject table corresponding to the teacher_id ?
yes
update query
$query = 'UPDATE subject SET subject_code = ' . "'" . $data['subject_code'] . "'" . ' WHERE teacher_id' = . "'" . $id . "'";
you dont need to enclose $id in quotes... its an integer
include the rest of the fields as well.. eg. subject_name.. etc
ok
rest of the fields separated by comma n like dis only
yes
$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
semester main bhi you dont need quotes
but it says der is an error in query :( and i removed those quotes
Parse error: syntax error, unexpected '=' in E:\xampp\htdocs\jmiams\application\models\subject_m.php on line 41
@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 ;
@tusharaheja thnx. i corrected it earlier though. but double quotes needs to be der for values dat are of string type.
@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.
@nkmittal4994 Lets talk about this here