The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
![]() |
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! to this: Code: // main program paths - no trailing slashes! 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"); (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: |