I made in new custom php file lets say e.g sample.php placed in root folder accessing it through a ajax call in any module but i am not able to connect to database or perform any operation. How to do that anyone can help?
I made in new custom php file lets say e.g sample.php placed in root folder accessing it through a ajax call in any module but i am not able to connect to database or perform any operation. How to do that anyone can help?
Hi Umar,
Ideal way to go by sugar entry point checking but you can use following code as well.
Can you please write following code in top of the "sample.php" file and try to make your ajax call and database operations same as sugar way?
<?php
if(!defined('sugarEntry'))
define('sugarEntry', true);
require_once ('include/entryPoint.php');
global $db, $current_user;
<< YOUR CODE HERE >>
// HERE $db and $current_user are accessible same as sugar any module file
<< END HERE>>
?>
Hello Devang,
Thankyou for your reply.
Buddy i am trying to just echo the logged in username by doing this
$name = $current_user->name;
echo $name;
But nothing happening. Any idea whats wrong?
Thank-You
M.Umar Akhlaq
Hello Devang,
Thankyou for your reply.
Buddy i am trying to just echo the logged in username by doing this
$name = $current_user->name;
echo $name;
But nothing happening. Any idea whats wrong?
Thank-You
M.Umar Akhlaq
Can you please share your exact same file with me if possible?