MySQL to SQL possible

Associate
Joined
19 Jul 2006
Posts
1,847
Hi i dont know how difficult or if this is inposible but if i have a php script that referes to a "moodle" MySQL database, the only problem being our "moodle" database is in Microsofts SQL. all the database feilds and such should be the same just a different language.
Heres a link to the code i changed the extention to txt so you could get the file but it should end .php http://www.hargitech.co.uk/uploadcourse.txt

Thanks
 
You might want to check out the "mssql" module. It provides PHP with an API to query SQL/Server databases, and works very similar to the mySQL calls. The only catch is that mssql is often not available on a default php install, and you may need to install it. There's a useful guide at http://docs.moodle.org/en/Installing_MSSQL_for_PHP

Paul.
 
the file works perfectally on my local machine where we have moodle running on a MySQL database. Just on our server Moodle is running on MSSQL, so the file dont work
 
Hi

I recently converted a php script from MYSQL to MSSQL, I did this by changing all references in the code for MYSQL to MSSQL then trying each query function out individually to see if it worked. MYSQL and MSSQL use mainly the same query language but there are some slight differences so you have to test each query.

PHP:
   if ($mysqlresource1=mssql_query('SELECT `id` FROM `'.$CFG->prefix.'course_categories` WHERE `id`='.mssql_real_escape_string($categoryid))){
            return mssql_num_rows($mysqlresource1) ? true : false;
        } else {
            return false;
        }

Changed all references of mysql to mssql
 
Back
Top Bottom