Jump to content

Recommended Posts

Posted

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.

Posted

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 :confused:

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 account

Sign in

Already have an account? Sign in here.

Sign In Now



  • 47 When would you like EduGeek EDIT 2025 to be held?

    1. 1. Select a time period you can attend


      • I can make it in June\July
      • I can make it in August\Sept
      • Other time period. Comment below
      • Either time

×
×
  • Create New...