Forums

DB connection Problem - not saving to DB & blank page

Kinaski 17 Jun, 2009
Hi all

My third issue with the new chronoforms today😟

Ok I got my form which submits to salesforce with curl, sends email, and I just wanted to include a save to DB and everything would be perfect.

But when I created the table and made a connection with it on the form, when I test my form neither of the three functions commit (curl,email,save to db) and I'm left with the blank page (completely blank, no styles no template nothing). I check the db and there are also no records there.

Any ideas what maybe wrong here?

Thank you
Kinaski 17 Jun, 2009
One note

When I set the "Error Reporting" in global joomla config to 'Maximum' i receive following errors upon submitting the form:


Parse error: syntax error, unexpected '$', expecting T_VARIABLE in /ha/html/mysite/components/com_chronocontact/chronocontact.php(52) : eval()'d code on line 12


And also:


Fatal error: Call to a member function bind() on a non-object in /ha/html/mysite/components/com_chronocontact/libraries/customcode.php(59) : eval()'d code on line 13


Any ideas what could this mean?

Thanks
GreyHead 17 Jun, 2009
Hi Kinaski,

Yes, there's an error on the DB save. Please check the Autogenerated code box for your form and see if there is code there - if there is check around line 12 for anything odd.

The msot common cause of these errors is dashes (or other special characters) in field names that give MySQL indegistion.

Bob
Kinaski 17 Jun, 2009
This is the autogenerated code. I got no idea what's not ok here:


<?php
		$MyForm =& CFChronoForm::getInstance();
		if($MyForm->formparams("dbconnection") == "Yes"){
			$user = JFactory::getUser();			
			$row =& JTable::getInstance("chronoforms_trial_form", "Table");
			srand((double)microtime()*10000);
			$inum	=	"I" . substr(base64_encode(md5(rand())), 0, 16).md5(uniqid(mt_rand(), true));
			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());
			}
			$MyForm->tablerow["jos_chronoforms_trial_form"] = $row;
		}
		?>
		
GreyHead 17 Jun, 2009
Hi Kinaski,

That's OK - line 12 is where the fields get saved (sorry, I forgot they weren't listed there - busy day today).

Please check the field names on your form for any special characters. Or post the form html or a form backup here and I'll take a look.

Bob
Kinaski 17 Jun, 2009
Hi Bob,

Thank you for third time!

I just figured out that 2 of my form field names were something like this 001a0598d3hjk . Stupid salesforce autogenerated forms. I removed those fields from the db table and now the data submits well.

Phew! I hope from now on the process will go smoother..

Thank you

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

VPS & Email Hosting 20% discount
hostinger