• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Server closes connection when running sql

#1
[eluser]Kyle123[/eluser]
Hi All,

I'm just getting started with CI and right about now I feel like throwing my computer out of the window Wink

I'm running a development LAMP stack (turnkey) on a virtual machine and using MSSQL 2008 for the back end database.

I have a basic set-up (with a customised controller class that works perfectly) comprising of the following:

Model:
Code:
<?
class shouts_model extends CI_Model {

public function __construct()
{
  $this->load->database();
}

public function get_newest() {
  $sql = "Exec sp_wallboard_topShouts";
  $query = $this->db->query($sql);
  return $query->result();
}

Controller:
Code:
<?php
class Shoutboard extends MY_Controller {

public function __construct()
{
  parent::__construct();
  $this->load->model('shouts_model');
}


public function index(){
  
  $this->title = "Shout! Board";
  $this->keywords = "Shout Reporting";
  $this->javascript['page'] = "wallboard.js";
  $this->css['shout'] = "shoutboard.css";
  
  $this->data['top_shouts'] = $this->shouts_model->get_newest();
  $this->_render('pages/shoutboard');
}

}

View:
Code:
<ul>
&lt;? echo $top_shouts; ?&gt;
&lt;? foreach($top_shouts as $row): ?&gt;
<li>
  <div class="postit">
   <span class="label">To: &lt;? echo $row->from ?&gt;</span>
   <span class="label">From: &lt;? echo $row->sent ?&gt;</span>
   <p class="message">&lt;? echo $row->note ?&gt;</p>
  </div>
</li>
&lt;? endforeach; ?&gt;
</ul>

when the execution hits this line (as far as I can tell):
Code:
$query = $this->db->query($sql);
The server closes the connection and returns no data (error 324 in chrome, but I also get it in IE) and no error is displayed or in the logs.

All the rest of my code executes properly and this is the first issue that I've run into that's stumped me, at first I thought it was the recordset being returned by the database, but it is very simple and nothing special, 3 text fields and a date.

Any help/pointers would be very much appreciated (and would stop me having to buy a new computer!)

Thanks in advance



Messages In This Thread
Server closes connection when running sql - by El Forum - 01-03-2013, 07:56 AM
Server closes connection when running sql - by El Forum - 01-03-2013, 08:16 AM
Server closes connection when running sql - by El Forum - 01-03-2013, 08:34 AM
Server closes connection when running sql - by El Forum - 01-03-2013, 02:21 PM
Server closes connection when running sql - by El Forum - 01-04-2013, 04:02 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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