Tuesday 6 July 2010

How to get connection from doctrine to run sql query in Symfony?

Hey folks,

$db = Doctrine_Manager::getInstance()->getCurrentConnection();
$sql = "UPDATE admin_info SET admin_category='".$permissions."' WHERE username = '".$username."'";
$result = $db->execute($sql);       
return $result;

Cheers!

3 comments:

  1. that what I am looking for...

    thanx dude!

    ReplyDelete
  2. Hi,

    I was looking for how to get the database details out of the databases.yml file so I could run a raw SQL query against the MySQL database and I didn't realise it was as easy as this.

    Many thanks.

    Chris

    ReplyDelete