"Create table" not working

chriscaple 05 Jan, 2009
Hi - so... I can't create tables for any of my forms. Joomla 1.5.7, Linux server (CentOS), MySQL 5, PHP 5, latest ChronoForms... anytime I try to create a table for any form, it sits there for awhile and then goes to an "unknown error" page.

Tried it with forms I created in Dreamweaver and with forms I created using the wizard; simple forms, complicated forms... it won't create tables for any of them.

Any ideas?
GreyHead 05 Jan, 2009
Hi chriscaple,

No ideas. Please take a backup copy of one of your simpler forms using the Form Backup icon and post it here so that we can take a look at the form code.

Bob
chriscaple 05 Jan, 2009
Hi Bob,

Here you go. Just a simple one created with the form wizard.

Hey, hmm... interesting thing I just noticed - I turned on maximum error reporting on global configuration and now when I go to the "DB Connection" page for the form, there are a couple of notices - the first one is:

Notice: Undefined property: stdClass::$tablenames in /mysiteaddress/administrator/components/com_chronocontact/admin.chronocontact.html.php on line 1615

The second is -

Notice: Undefined property: stdClass::$dbconnection in /mysiteaddress/administrator/components/com_chronocontact/admin.chronocontact.html.php on line 1625 value="No">No

Weird...
chriscaple 05 Jan, 2009
Also it's showing this on the main forms manager page now -

Notice: Undefined property: stdClass::$tablenames in /mysiteaddress/administrator/components/com_chronocontact/admin.chronocontact.html.php on line 123
GreyHead 05 Jan, 2009
Hi chriscaple,

Thanks for the form - I'll take a look shortly.

Don't worry about the PHP warning messages, they'll go away of you re-set the Error Reporting and Max is workng on taking them out of the next version.

Bob
chriscaple 05 Jan, 2009
Oh, okay, cool. I'll disregard 'em, then.

Thanks for looking at the form!

If there's any other information you need, let me know and I'll get it over to you.
GreyHead 05 Jan, 2009
Hi chriscaple,

It all works OK here :-( the Table creates OK, and the form data saves OK. WAMPP MySQL 5.05, PHP 5.2.6 latest CF

Maybe try echoing out the sql query and testing that in PHPMyAdmin.

Bob
kevincam 07 Jan, 2009
I'm having this same problem
Max_admin 07 Jan, 2009
Hi Kevin, Can you show me your form code ?

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
chriscaple 17 Jan, 2009
Still haven't got this working.

Just set up a new 1.5.9 installation to test, installed latest chronoforms component, used the form wizard to create a simple test form, published it, clicked on create table, selected all the create columns, save... it sits there for awhile, and then goes to a white screen that says "This webpage is not available."

Error 2 (net::ERR_FAILED): Unknown error.

Hmmm... it's got to be my server. I've got a MediaTemple DV server. Doesn't work there. I also have a MediaTemple gridserver (gs). I just tried it there - works fine.

Any idea what kind of server settings could be screwing up table creation?
GreyHead 17 Jan, 2009
Hi chriscaple,

This sounds like it could be some kind of a database permission problem - but I can't image why if the rest of Joomla is working. Maybe your Joomla db user doesn't have permission to create tables??? I'm groping at straws here. Where is your site hosted - is it using MySQL?

Bob
chriscaple 17 Jan, 2009
Hi Bob,

I know, it's weird. My hosting company is MediaTemple - <!-- w --><a class="postlink" href="http://www.mediatemple.net">www.mediatemple.net</a><!-- w -->. I have two products there - a gridserver (cheaper fancied-up shared hosting in a grid environment, MySQL 4, PHP5), and a (dv) server, which is a dedicated virtual server that I have full control over, running MySQL 5, PHP 5, and CentOS Linux.
chriscaple 17 Jan, 2009
The joomla db user would have to have permission to create tables though, right? I mean, to even install joomla in the first place?
GreyHead 17 Jan, 2009
Hi chriscaple,

Yes absolutely - you can't setup Joomla without write permissions . . .

My inclination is to test the sql with EasySQL.

Bob
chriscaple 17 Jan, 2009
How would one go about doing that - testing the sql with EasySQL?
GreyHead 17 Jan, 2009
Hi chriscaple,

Hmmm . . . not so easy. I took a look and the way Max has written the code in CF v3.0 makes it impossible without hacking into some of the code Joomla files :-(

Bob
chriscaple 17 Jan, 2009
Hm. Well... any idea what server settings might be interfering with creating tables?

Maybe something in php.ini?
Max_admin 18 Jan, 2009
Hi chriscaple,

do you have phpmyadmin ? can you get some create table SQL statement and try to execute it ? make sure you are logged in to phpmyadmin with the same joomla mysql username/pass!

it doesn't work at both servers ?

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 18 Jan, 2009
Hi chriscaple,

EasySQL is a Joomla extension that lets you enter SQL from the Joomla Admin - nothing like as complete as PHPMyAdmin but still very useful. Getting the SQL that ChronoForms is using is more difficult as you can't just dump it out from ChronoForms any more.

Bob
chriscaple 18 Jan, 2009
I do have phpmyadmin.

I just tried creating a table on the dv server in phpmyadmin - used this code:

CREATE TABLE people (name VARCHAR(30), age INTEGER, height FLOAT, date DATETIME)

It worked. Logged in with the same username/pass as are in the Joomla installation.

And yet... chronoforms won't create tables on that server.

Weird...
GreyHead 18 Jan, 2009
Hi chriscaple,

Try this experiment please.

Create a new form and in the form html put this code
<?php
$db->JFactory::getDBO();
echo "db: ".print_r($db, true)."<br /><br />";
$query = "CREATE TABLE` #__people` (name VARCHAR(30), age INTEGER, height FLOAT, date DATETIME);";
$db->setQuery($query);
$db->query();
echo "db: ".$db->getErrorMsg()."<br /><br />";
?>
Give the form a name, save it and click the link to open the form in a new window/tab. Let's see what comes back.

Bob
chriscaple 19 Jan, 2009
Huh... this is really weird... I did what you said... and when I clicked on "save"... I get the same error/behaviour that I get when I try to create tables on existing forms.

This webpage is not available.

The webpage at http://mysite/administrator/index2.php might be temporarily down or it may have moved permanently to a new web address.

  More information on this error
Below is the original error message

Error 2 (net::ERR_FAILED): Unknown error.


I tried it a few times. Put your code in the html area, gave it a name, hit save... same thing happened every time.

If I create a new form with just some basic table and form fields in it and save that, it saves fine and takes me back to the main chronoforms screen.

That's pretty odd, ain't it?
chriscaple 19 Jan, 2009
Replying belatedly to Max -

I have two servers at mediatemple.net - one of their "gridserver" accounts and a "dedicated virtual" account. Chronoforms works totally fine on the gridserver, but not on the dedicated virtual.
GreyHead 19 Jan, 2009
Hi chriscaple,

This really is an ISP problem. Next step apart from that is to comment out all the lines in that form code, then uncomment them one by one until you see which one triggers the error.

Bob
chriscaple 19 Jan, 2009
Thanks for your assistance. Really appreciate it. Will try the commenting thing.

Also - is that meant to be a : or a ; at the end of the first line there?
GreyHead 19 Jan, 2009
Hi chriscaple,

That *should* be a ; . . . I'll go fix it. Sorry.

Bob
chriscaple 19 Jan, 2009
Okay, cool, thanks.

I tried putting that code into a form on the other server - the gridserver, the one that works - and it saved it fine; I published it and then clicked the link and got this -

Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in /home/6504/domains/radiofreealbatross.com/html/components/com_chronocontact/chronocontact.html.php(320) : eval()'d code on line 2
chriscaple 19 Jan, 2009
Really strange - even if I comment out *all* the code there... on the dv server... when I try to save the form, it still hangs for a few seconds and then goes to the "this webpage is not available" screen.

I tried commenting with // and with <!-- -->. Same thing either way.

Weird.
GreyHead 19 Jan, 2009
Hi Chriscaple,

No typo this time - just faulty memory :-( - line 2 was malformed. I've tested this and it does create a table for me.
<?php
$db =& JFactory::getDBO();
echo "db: ".print_r($db, true)."<br /><br />";
$query = "CREATE TABLE `#__people` (name VARCHAR(30), age INTEGER, height FLOAT, date DATETIME);";
$db->setQuery($query);
$db->query();
echo "dbErrorMsg: ".$db->getErrorMsg()."<br /><br />";
?>

Bob
pat01 19 Jan, 2009
Hello

In my case CF actually does create the table, but it dosen't save the data from the submitted form into it.
Instead, if I enable the storage of the data, I get the following error message as soon as the contact form is displaed:

Parse error: syntax error, unexpected '-', expecting ',' or ';' in /web/development/components/com_chronocontact/chronocontact.php(41) : eval()'d code on line 15

Do you have any idea?

Thank you very much!

Patrick

Joomla! 1.5.9, CF v3 stable
GreyHead 19 Jan, 2009
Hi pat01,

Yes, looks like you have a dash in your form name. This is fine there but gives this error when it's converted into a MySQL table name. The easy answer is to rename your form without the - and recreate a new table.

Bob
pat01 20 Jan, 2009
Hi Bob

My form is named "Kontaktformular". The table name is called "jos_chronoforms_kontaktformular".

As you can see, there is no dash or any other special character.

I did not get the error when CF did create the table. I get the error as soon as I set the setting "Enable Data storage" to "Yes". Of course I did select the proper table from the field below "Tablename(s). :wink:

What else could it be?

Thank you very much!

Patrick
GreyHead 20 Jan, 2009
Hi Patrick,

OK - in that case please check the code in the AutoGenerated Code window around line 15 and see what is there.

Bob
pat01 20 Jan, 2009
Here is the code:

<?php
		if($paramsvalues->dbconnection == "Yes"){
			$user = JFactory::getUser();			
			$row =& JTable::getInstance("chronoforms_kontaktformular", "Table");
			srand((double)microtime()*10000);
			$inum	=	"I" . substr(base64_encode(md5(rand())), 0, 16);
			JRequest::setVar( "recordtime", JRequest::getVar( "recordtime", date("Y-m-d")." - ".date("H:i:s"), "post", "string", "" ));
			JRequest::setVar( "ipaddress", JRequest::getVar( "ipaddress", $_SERVER["REMOTE_ADDR"], "post", "string", "" ));
			JRequest::setVar( "uid", JRequest::getVar( "uid", $inum, "post", "string", "" ));
			JRequest::setVar( "cf_user_id", JRequest::getVar( "cf_user_id", $user->id, "post", "int", "" ));
			$post = JRequest::get( "post" , JREQUEST_ALLOWRAW );			
			if (!$row->bind( $post )) {
				JError::raiseWarning(100, $row->getError());
			}				
			if (!$row->store()) {
				JError::raiseWarning(100, $row->getError());
			}
			global $row_jos_chronoforms_kontaktformular;
			$row_jos_chronoforms_kontaktformular = $row;
		}
		?>


- Patrick
GreyHead 20 Jan, 2009
Hi Patrick,

Than looks fine . . . a bit baffled. What field names do you have - there should be a list under the AutoGenrerated code window.

Bob
pat01 20 Jan, 2009
That's

Vorname,Nachname,Strasse,PLZ,Ort,Telefon,Email,Mitteilung

and below

text,text,text,text,text,text,text,textarea

Before I had "Email" named "E-Mail". Then I did rename it to "Email" everywhere (tab Form Code, tab AutoGenerated code and column name in the database).

But I still get the error.

- Patrick

EDIT: I just found the error. I did forget to rename "E-Mail" to "Email" in the tab Email Templates (I have custom code there).
Now it's working fine! What a simple mistake 🙄

Thank you very much for your help!

- Patrick
GreyHead 20 Jan, 2009
Hi Patrick,

Well found !! :-)

Bob
pat01 20 Jan, 2009
Hi Bob

Well, sometimes the solution is so easy... 😀

Thanks again!

- Patrick
This topic is locked and no more replies can be posted.