• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CodeIgniter and MSSQL uniqueidentifier issue

Probably a simple issue, but I can't seem to figure it out.

I have a small desktop with ubuntu 8.04 Server installed on it, running Apache2, PHP5 with sybase support enabled and I am having an issue.

I am interfacing with an MSCRM MSSQL server. The way CRM does everything the Primary key for every table is uniqueidentifier. I am connecting to the database just fine. I can run simple queries just fine. However if I try to use a uniqueidentifier to join tables, or pass it to another query or even print the uniqueidentifier to screen it comes through as gobbledy-gook.

MODEL: contact.php
function GetCustomerId($ScriptingContactId)
    $query = $this->db->get();
    $row = $query->row();
    return $row->ParentAccountId;

CONTROLLER: content.php
class Content extends Controller {

    function Content()
        #$this->userid = $this->session->userdata('ContactId');
        $this->userid = '{61463116-58AA-DC11-AF0F-0019B9CCA70F}';
    function index()
    function overview()
        $data['page'] = 'overview';
        $data['page_title'] = 'Account Overview';
        $data['customerid'] = $this->contact->GetCustomerId($this->userid);
        #$data['customer'] = $this->account->Location($this->contact->GetCustomerId($this->userid));
        #$data['projects'] = $this->project->GetProjects($this->userid);
        #print $this->userid;
Basically the only query running is the contact->GetCustomerId

Here is the output:
Array ( [page] => overview [page_title] => Account Overview [customerid] => >#Q4��#ܯ##�̧# )

I am thinking maybe it is a setting on this new server, since I have also noticed when I print out contents from the database on another project on this server, the quotes are showing those funky characters.

I am open to any and all suggestions. I have a workaround right now, in that my MSSQL database is synced to a MySQL db once a a day to house the information, but would really like to get this working tapping straight into MSSQL.


Have you dried doing the following directly with MYSQL shell
select accountid from New_ProjectExtensionBase where New_ScriptingContactId = '<scid>';
select customerid from accountbase where accountid = '<accountid>';

Then you can narrow down if it is a CI problem or not.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.