【发布时间】:2014-01-29 17:05:06
【问题描述】:
这是我在 Magento 中使用的核心 PHP 代码。
$model_moodle = mysql_connect("localhost","root","123456")
or die("Unable to connect to MySQL");
//select a database to work with
$selected = mysql_select_db("moodle",$model_moodle)
or die("Could not select moodle");
//execute the SQL query and return records
$result = mysql_query("SELECT id FROM mdl_course where shortname ='".$data."'");
//fetch tha data from the database
while ($row = mysql_fetch_array($result)) {
$course_id = $row['id'];//display the results
}
//echo "Cource id is=".$course_id;
//close the connection
mysql_close($model_moodle);
我需要使用此代码,但使用 Magento 外部数据库连接。
我在 Magento 中使用“Moodle”数据库。但我需要 Magento 方式的代码。
【问题讨论】:
-
检查一下我认为这会有所帮助..stackoverflow.com/questions/4654379/…
-
谢谢@Rocksis 但我认为这是漫长的道路......建立外部数据库连接......!
-
试着在这里问你的问题magento.stackexchange.com
-
非常感谢 RS Sisodiya...!
-
也看看这个phpcmsframework.blogspot.in/2012/11/…我觉得没有捷径
标签: php mysql magento-1.7 moodle