300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > moodle mysql Moodle: 查询任意数据库

moodle mysql Moodle: 查询任意数据库

时间:2021-04-30 22:22:15

相关推荐

moodle mysql Moodle: 查询任意数据库

代码:

if (!file_exists('../../config.php')) {

header('Location: ../../install.php');

die;

}

require_once('../../config.php');

require_once("../../mod/feedback/lib.php");

// 课程ID

$course_id = 22; //课程ID

/*

$sql = "select

m.id as m_id,

m.name as m_name,

cm.id as cm_id,

cm.course as cm_course,

cm.module as cm_module,

cm.instance as cm_instance,

cm.instance as cm_instance,

cm.section as cm_section

from {modules} m, {course_modules} cm where cm.module=m.id and cm.course = '$course_id' and cm.id in (SELECT cs.sequence FROM {course_sections} cs where cs.course = '$course_id')";

*/

// 显示所有tables

//$sql = "SHOW TABLES";

// 显示某一表的所有字段

//$sql = "SHOW COLUMNS FROM {quiz_feedback}";

// 自定义查询

$sql = "select * FROM {course_modules} cm where cm.course = '$course_id' and cm.module=7";

//$sql = "select cm.*, m.* from {modules} m, {course_modules} cm where cm.module=m.id and cm.course = '$course_id' and cm.id in (SELECT cs.sequence FROM {course_sections} cs where cs.course = '$course_id')";

$res = $DB->get_records_sql($sql);

echo '

'; echo '$cm===>'; print_r($res); echo '

'; die;

相关

Related Posts

MySQL 查询时强制区分大小写

让MySQL搜索区分大小写或排序时分大小写方法如下: 1.在SQL中强制 SELECT `field` FROM `table` WHERE BINARY `colunm` = 'xxxxxx' SELECT `field`…

Magento 数据库配置文件 Magento where is database configuration file?

Find the local.xml in local \magentoappetclocal.xml

… …

Moodle: 开启错误提示

config.php file: $CFG->debug = 38911; $CFG->debugdisplay = true; For Moodle 2.0 the possible settings…

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。