The Slim Framework support forum has moved to http://discourse.slimframework.com. This Tender forum is no longer maintained or monitored.

Uncaught exception 'RuntimeException' from mysql_select_db

Gumuruh's Avatar

Gumuruh

19 Mar, 2012 10:42 AM

Hello Slim Framework users!
I'm encountering some facts that mysql statements getting died lately.

I'm actually connecting my current php file to the mysql database.
And then I'm trying to use the Slim Framework to obtain the data.

Here are my code

'// CODE STARTED

function getConnection(){

echo "getConnection ";
$this->dbconn = mysql_connect($this->db, $this->user, $this->pass);
    if (!$this->dbconn) {
        echo "Cannot connect to database.";
    }

    $dbconns  = null;
    $dbconns = mysql_select_db('fams', $this->dbconn);

    if(!$dbconns){
        return null;
    } else {
        return $dbconns;    
    }

// END OF getConnection method                  
}

// ENDED CODE'

if I used the code '$dbconns = mysql_select_db('fams', $this->dbconn);' from there on, Slim Frameworks gives me Error;
It said, Uncaught exception 'RuntimeException' . Huh? What's that?

  1. Support Staff 1 Posted by Andrew Smith on 19 Mar, 2012 11:04 AM

    Andrew Smith's Avatar

    can you paste your entire code and not just part as it is difficult to help without all the code. Also this might not be Slim related but I will try and help anyway.

  2. Andrew Smith closed this discussion on 10 Jul, 2012 12:26 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac