Databases: Need help with INSERT

Databases: Need help with INSERT

ដោយ Javier Martínez Alfonso នៅ
ចំនួនតប៖ 3
Hi everybody!

I have a php file which, among other things, has the following:

execute_sql("INSERT INTO mdl_p_resumenes (id, nombre, area, evaluador) VALUES ('$id_autor', '$original', '$destino', '$evaluador2')");

As you can see, I´m trying to insert a new row in the table mdl_p_resumenes, but it doesn´t work! It returns an error ក្រៀមក្រំ.

But if I try it with some certain values it works and it adds a new row:

execute_sql("INSERT INTO mdl_p_resumenes (id, nombre, area, evaluador) VALUES ('10', 'archivo.txt', 'area del congreso', '15')");

I also check $id_autor, $original... before doing that, and they all have the right values.

Can somebody help me please???

មធ្យមភាគនៃរង្វាយតម្លៃ: -
ឆ្លើយតបទៅកាន់ Javier Martínez Alfonso

Re: Databases: Need help with INSERT

ដោយ Javier Martínez Alfonso នៅ
I´ve just solved it, the problem wasn´t there
មធ្យមភាគនៃរង្វាយតម្លៃ: -
ឆ្លើយតបទៅកាន់ Javier Martínez Alfonso

Re: Databases: Need help with INSERT

ដោយ Tim Hunt នៅ
រូបភាព Core developers រូបភាព Documentation writers រូបភាព Particularly helpful Moodlers រូបភាព Peer reviewers រូបភាព Plugin developers
But you probably ought to be using the insert_record function instead.
មធ្យមភាគនៃរង្វាយតម្លៃ: -
ឆ្លើយតបទៅកាន់ Tim Hunt

Re: Databases: Need help with INSERT

ដោយ Ger Tielemans នៅ

In the old version of Moodle I hacked the rights of the admin in such a way that course creators could adress a course to a teacher EVEN when the were not a teacher of that course themselves.

I gave up this dangeruous hacking and try now to use this function, but it seems not to work:

add_teacher($userid, $courseid, $editall=1, $role="teacher", $timestart=0, $timeend=0, $enrol="manual");

I populate userid and courseid, but..

any idea?

មធ្យមភាគនៃរង្វាយតម្លៃ: -