apeo Posted January 8, 2009 Report Posted January 8, 2009 I've trying to get the moodle and sims to work together as detailed by CyberNerd but I've hit a few snags so i need to find out whats working and whats not. What i need to do is to seen if i can write a php script that will connect to the SQL server and retrieve a bit of info to print to screen. Heres what i have so far: PHP - Connection to Server: $user="sa"; $password=""; $database="sims"; $host = ",1433"; $link = mssql_connect($host,$user,$password); if(!$link) { die("Didnt work."); } else { @mssql_select_db($database) or die( "Unable to select database"); echo("it works?!"); } mssql_close(); ?> SQL 2005 - SIMS View USE [sims] GO /****** Object: View [dbo].[mdl_enrolments] Script Date: 12/05/2007 17:16:34 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER VIEW [dbo].[mdl_enrolments] AS SELECT DISTINCT class_name AS course, staff_initials AS person, 'editingteacher' AS role FROM sims.curr_via_classperiods AS p UNION SELECT DISTINCT p.class_name AS course, m.unique_pupil_no AS person, 'student' AS role FROM sims.curr_via_classperiods AS p INNER JOIN sims.stud_via_group_members AS m ON m.base_group_id = p.base_group_id I now need the code to get some data and output it.
budgester Posted January 8, 2009 Report Posted January 8, 2009 Does the PHP script connect to the server ?
apeo Posted January 9, 2009 Author Report Posted January 9, 2009 It doesnt show any errors so I think it does. I want to try pulling some data out to see if its possible.
Cravon Posted January 16, 2009 Report Posted January 16, 2009 How about an ODBC connection to the sims database? $link = odbc_connect (DSN/DB, username, password); $rs = odbc_exec($link,$query); odbc_close ($link); Don't know if that is a work round that will work for you
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now