Hi,
I want to use database credentials from "config.php" on my "logic hooks" file for database connectivity.
Regards
Hi,
I want to use database credentials from "config.php" on my "logic hooks" file for database connectivity.
Regards
You don't need to create a separate connection to query the database via a logic hook.
Give this example a look:
http://cheleguanaco.blogspot.com/200...k-example.html
Regards,
Angel Magaņa
Co-Author: Implementing SugarCRM 5.x (Packt Publishing -- Sept. 2010)
Blog: http://cheleguanaco.blogspot.com.
Twitter: @cheleguanaco.
________
| Projects: |_____________________________________
|
| CandyWrapper (.NET Wrapper for SugarCRM SOAP API). Source now available on GitHub!
| GoldMine to SugarCRM Express Conversion. Latest: 1.0.1.7 (Nov. 3, 2009)
| CRM SkyDialer (Skype Integration). Latest: 1.0.2 (Feb. 17, 2010)
| Round Robin Leads Assignment
| Phone Number Formatter
| CaseTwit (Twitter Integration)
______________________________________________
Hi Angel,
Yes you are right but see we define these lines in logic hooks file
$hook_version = 1;
$hook_array = Array();
$hook_array['before_save'][] = Array(1, 'assignUser', 'custom/modules/Cases/autoUserAssignment.php', 'UserAssignment', 'updateCase');
We don't need to configure database connection in our "logic_hooks.php" because there's no database activity is involve.
But, In "autoUserAssignment.php" we should have to configure database connection just because of database activity is involve.
Now, what you say about it?
How can we configure database connection from (config.php database credentials) in "autoUserAssignment.php" ?
That should workPHP Code:require_once pathtoconfig.php
include_once pathtoconfig_override.php
$sql_connection = mysql_connect($sugar_config['dbconfig']['db_host_name'], $sugar_config['dbconfig']['db_user_name'], $sugar_config['dbconfig']['db_password']);
$sql_db = mysql_select_db($sugar_config['dbconfig']['db_name']);
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks