The following warnings occurred:
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined variable $newpmmsg - Line: 40 - File: global.php(841) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/global.php(841) : eval()'d code 40 errorHandler->error
/global.php 841 eval
/printthread.php 16 require_once
Warning [2] Undefined array key "style" - Line: 909 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 909 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$lang_select_default - Line: 5024 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 5024 errorHandler->error
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions.php 5044 is_member
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1370 fetch_forum_permissions
/printthread.php 76 forum_permissions
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error



Form Tools
Form Tools was unable to make a connection to the database hostname. - Printable Version

+- Form Tools (https://forums.formtools.org)
+-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1)
+--- Forum: API (https://forums.formtools.org/forumdisplay.php?fid=17)
+--- Thread: Form Tools was unable to make a connection to the database hostname. (/showthread.php?tid=1745)



Form Tools was unable to make a connection to the database hostname. - grozzy - Nov 11th, 2011

I am getting the error in the subject when trying to use the API in a Joomla article. The API and Form Tools installation are on the same website and server but I cannot figure out how to get it to work. I am using a Joomla plugin to add the php code to an article and I have even tried two different plugins and get the same result.


RE: Form Tools was unable to make a connection to the database hostname. - Ben - Nov 12th, 2011

Hi Grozzy,

From what you described, my hunch is that the necessary Form Tools database settings stored in your /global/config.php file are loaded from within a function/class method call, which only loads them in local scope. So any subsequent Form Tools function calls would attempt to set them as globals, but fail, because they weren't found.This would lead to the problem you mentioned.

Is it just for a form, or are you running Form Tools from within the plugin? If the latter, I'm not too sure of a solution... but for a form, you could try altering your config.php contents to explicitly set them to globals. I'm not positive this would work, but it seems reasonable.

Try changing this:

Code:
// main program paths - no trailing slashes!
$g_root_url = "...";
$g_root_dir = "..";

// database settings
$g_db_hostname = "...";
$g_db_name = "...";
$g_db_username = "...";
$g_db_password = "...";
$g_table_prefix = "...";

to this:

Code:
// main program paths - no trailing slashes!
$GLOBALS["g_root_url"] = "...";
$GLOBALS["g_root_dir"] = "...";

// database settings
$GLOBALS["g_db_hostname"] = "...";
$GLOBALS["g_db_name"] = "...";
$GLOBALS["g_db_username"] = "...";
$GLOBALS["g_db_password"] = "...";
$GLOBALS["g_table_prefix"] = "...";

Then, whenever the config.php is included *anywhere*, those vars should be set in global scope.

Anyway, give it a go and let me know how it goes.

- Ben


RE: Form Tools was unable to make a connection to the database hostname. - grozzy - Nov 12th, 2011

Hi Ben, thanks for the quick response. I am using the API just for a form and your solution to making those changes in the config file worked! However, now when I submit a form I get this error:

Fatal error: Call to undefined method stdClass::assign() in /home2/dund7520/public_html/formtools/global/code/themes.php on line 211

Any ideas on that?

Thanks.

Eric


RE: Form Tools was unable to make a connection to the database hostname. - digfish_aaualg - Dec 15th, 2011

Hi grozzy

I had exactly the same problem as you. I removed the cookies and it worked (alltough I was submitting the form in 'developing mode' with the line:
Code:
$fields = ft_api_init_form_page("", "test");
The problem is, I don't know if when the form you're using it goes live removing the cookies will solve the problem. We can't prompt the final user to remove the cookies or do something with PHP to delete the cookies in the user's browser!

(Nov 12th, 2011, 1:45 PM)grozzy Wrote: Hi Ben, thanks for the quick response. I am using the API just for a form and your solution to making those changes in the config file worked! However, now when I submit a form I get this error:

Fatal error: Call to undefined method stdClass::assign() in /home2/dund7520/public_html/formtools/global/code/themes.php on line 211

Any ideas on that?

Thanks.

Eric