Show data not working?

Post any questions you may have here

Show data not working?

Postby jpc0480 on Fri Jul 04, 2008 6:31 am

I made a form earlier that was storing everything in the Show Data field. Recently I revised my form and made a new one from scratch. Now I've noticed that it is not posting this to the Show Data section. I have it set to email the results so it's not a big loss, just something I would like to see. Is there a setting that maybe I turned off? Or something I didn't set up?
jpc0480
Fresh Boarder
 
Posts: 10
Joined: Fri Jul 04, 2008 1:11 am
Location: Charleston, SC,

Re:Show data not working?

Postby GreyHead on Fri Jul 04, 2008 11:03 am

Hi jpc0480,

You need to click the 'Create Data Table' link in the forms manager to create the code to save the form data in the database. If you don't see this but have 'Show Data' instead then something is wrong with your form . . .

Bob
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
User avatar
GreyHead
Platinum Boarder
 
Posts: 3438
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Re:Show data not working?

Postby jpc0480 on Fri Jul 04, 2008 5:59 pm

You are right... Something must be wrong with the form. I clicked on Create Table up at the top, and it said that a table was already created for this form. When I click on Show Data I get nothing. Is there maybe a problem with MySQL or is there something I can edit? It seems as if this may be a database problem, although I'm not quite sure.
jpc0480
Fresh Boarder
 
Posts: 10
Joined: Fri Jul 04, 2008 1:11 am
Location: Charleston, SC,

Re:Show data not working?

Postby GreyHead on Sat Jul 05, 2008 5:16 am

Hi jpc0480,

What is in the Autogenerated code box for this form? You did say that you created it from scratch - not by copying another form or restoring a backup?

Bob
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
User avatar
GreyHead
Platinum Boarder
 
Posts: 3438
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Re:Show data not working?

Postby jpc0480 on Sat Jul 05, 2008 1:00 pm

Nothing... Might this be the problem?
jpc0480
Fresh Boarder
 
Posts: 10
Joined: Fri Jul 04, 2008 1:11 am
Location: Charleston, SC,

Re:Show data not working?

Postby GreyHead on Sat Jul 05, 2008 1:16 pm

Hi jpc0480,

Yes, check out the form id - the second column in the Forms Manager and see if you have a ..._chronoforms_... table in the database that ends with the id. If so, and it's not needed, you can delete the table and the 'Create Table' link should show up again for the form.

Bob
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
User avatar
GreyHead
Platinum Boarder
 
Posts: 3438
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Re:Show data not working?

Postby jpc0480 on Sat Jul 05, 2008 1:20 pm

OK... I backed up the form, deleted it, and then restored. When I restored the form I had an option to create the table. I selected it and confirmed my fields. Now I have some code in the auto generated tab. However I'm still not showing anything in the show data field. Here is the auto generated code. Hopefully we can figure this out. Thanks for your help.
Code: Select all
<?php
   $database =& JFactory::getDBO();
   srand((double)microtime()*10000);
   $inum   =   "I" . substr(base64_encode(md5(rand())), 0, 16);
   
$database->setQuery( "INSERT INTO #__chronoforms_2
VALUES  (
'' ,
'".$inum."',
'". date('Y-m-d')." - ".date("H:i:s")."',
'".$_SERVER['REMOTE_ADDR']."' ,
'".JRequest::getVar('name','', 'post', 'string', '' )."'
, '".JRequest::getVar('company','', 'post', 'string', '' )."' ,
'".JRequest::getVar('email','', 'post', 'string', '' )."' ,
'".JRequest::getVar('phone','', 'post', 'string', '' )."' ,
'".JRequest::getVar('website','', 'post', 'string', '' )."' ,
'".JRequest::getVar('url','', 'post', 'string', '' )."' ,
'".JRequest::getVar('complete','', 'post', 'string', '' )."' ,
'".JRequest::getVar('em_svc','', 'post', 'string', '' )."' ,
'".JRequest::getVar('hosting','', 'post', 'string', '' )."' ,
'".JRequest::getVar('other','', 'post', 'string', '' )."' ,
'".JRequest::getVar('redesign','', 'post', 'string', '' )."' ,
'".JRequest::getVar('maintenance','', 'post', 'string', '' )."' ,
'".JRequest::getVar('ecommerce','', 'post', 'string', '' )."' ,
'".JRequest::getVar('time','', 'post', 'string', '' )."' ,
'".JRequest::getVar('method','', 'post', 'string', '' )."' ,
'".JRequest::getVar('description','', 'post', 'string', '' )."' ,
'".JRequest::getVar('reset','', 'post', 'string', '' )."' ,
'".JRequest::getVar('submit','', 'post', 'string', '' )."');"
);
if (!$database->query()) {
echo "<script> alert('".$database->getErrorMsg()."');
window.history.go(-1); </script>
";
}
?>
jpc0480
Fresh Boarder
 
Posts: 10
Joined: Fri Jul 04, 2008 1:11 am
Location: Charleston, SC,

Re:Show data not working?

Postby jpc0480 on Sat Jul 05, 2008 1:38 pm

Ok... I went back and checked the database and removed the table and went back to chronoforms and then created the table and I'm still not receiving anything in the show data...
jpc0480
Fresh Boarder
 
Posts: 10
Joined: Fri Jul 04, 2008 1:11 am
Location: Charleston, SC,

Re:Show data not working?

Postby jpc0480 on Sat Jul 05, 2008 1:45 pm

Ok here is the new code... My database now has a table labled jos_chronoforms_1. I'm still not getting anything to show up in the show data field...
Code: Select all
<?php
   $database =& JFactory::getDBO();
   srand((double)microtime()*10000);
   $inum   =   "I" . substr(base64_encode(md5(rand())), 0, 16);
   
$database->setQuery( "INSERT INTO #__chronoforms_1
VALUES  (
'' ,
'".$inum."',
'". date('Y-m-d')." - ".date("H:i:s")."',
'".$_SERVER['REMOTE_ADDR']."' ,
'".JRequest::getVar('name','', 'post', 'string', '' )."' ,
'".JRequest::getVar('company','', 'post', 'string', '' )."' ,
'".JRequest::getVar('email','', 'post', 'string', '' )."' ,
'".JRequest::getVar('phone','', 'post', 'string', '' )."' ,
'".JRequest::getVar('website','', 'post', 'string', '' )."' ,
'".JRequest::getVar('url','', 'post', 'string', '' )."' ,
'".JRequest::getVar('complete','', 'post', 'string', '' )."' ,
'".JRequest::getVar('em_svc','', 'post', 'string', '' )."' ,
'".JRequest::getVar('hosting','', 'post', 'string', '' )."' ,
'".JRequest::getVar('other','', 'post', 'string', '' )."' ,
'".JRequest::getVar('redesign','', 'post', 'string', '' )."' ,
'".JRequest::getVar('maintenance','', 'post', 'string', '' )."' ,
'".JRequest::getVar('ecommerce','', 'post', 'string', '' )."' ,
'".JRequest::getVar('time','', 'post', 'string', '' )."' ,
'".JRequest::getVar('method','', 'post', 'string', '' )."' ,
'".JRequest::getVar('description','', 'post', 'string', '' )."' ,
'".JRequest::getVarif (!$database->query()) {
echo "<script> alert('".$database->getErrorMsg()."');
window.history.go(-1); </script>
";
}
?>
jpc0480
Fresh Boarder
 
Posts: 10
Joined: Fri Jul 04, 2008 1:11 am
Location: Charleston, SC,

Re:Show data not working?

Postby GreyHead on Sat Jul 05, 2008 2:00 pm

Hi jpc0480,

There's a bit missing here
Code: Select all
'".JRequest::getVarif (!$database->query())
is that just a cut and paste slip?

The rest looks OK, please take a Form Backup and psot it here or mail it to the address in my sig and I'll take a closer look.

Bob
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
User avatar
GreyHead
Platinum Boarder
 
Posts: 3438
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Re:Show data not working?

Postby jpc0480 on Sat Jul 05, 2008 2:08 pm

No that wasn't a slip... That code isn't there. Here is the backup. [file name=Quote.cfbak size=10558]http://www.chronoengine.com/images/fbfiles/files/Quote.cfbak[/file]
jpc0480
Fresh Boarder
 
Posts: 10
Joined: Fri Jul 04, 2008 1:11 am
Location: Charleston, SC,

Re:Show data not working?

Postby GreyHead on Sun Jul 06, 2008 9:33 am

Hi jpc0480,

Your form appears to work OK for me. I did have to add 'addslashes' to the textarea input, mainly because I typed some junk in there. Here's the Autogenerated code I ended up with - including some debug code.
Code: Select all
<?php
$database =& JFactory::getDBO();
srand((double)microtime()*10000);
$inum = "I" . substr(base64_encode(md5(rand())), 0, 16);
$sql = "INSERT INTO #__chronoforms_67
VALUES  (
'' ,
  '".$inum."',
'". date('Y-m-d')." - ".date("H:i:s")."', '".$_SERVER['REMOTE_ADDR']."' ,
'".JRequest::getVar('name','', 'post', 'string', '' )."' ,
'".JRequest::getVar('company','', 'post', 'string', '' )."' ,
'".JRequest::getVar('email','', 'post', 'string', '' )."' ,
'".JRequest::getVar('phone','', 'post', 'string', '' )."' ,
'".JRequest::getVar('website','', 'post', 'string', '' )."' ,
'".JRequest::getVar('url','', 'post', 'string', '' )."' ,
'".JRequest::getVar('complete','', 'post', 'string', '' )."' ,
'".JRequest::getVar('em_svc','', 'post', 'string', '' )."' ,
'".JRequest::getVar('hosting','', 'post', 'string', '' )."' ,
'".JRequest::getVar('other','', 'post', 'string', '' )."' ,
'".JRequest::getVar('redesign','', 'post', 'string', '' )."' ,
'".JRequest::getVar('maintenance','', 'post', 'string', '' )."' ,
'".JRequest::getVar('ecommerce','', 'post', 'string', '' )."' ,
'".JRequest::getVar('time','', 'post', 'string', '' )."' ,
'".JRequest::getVar('method','', 'post', 'string', '' )."' ,
'".addslashes(JRequest::getVar('description','', 'post', 'string', '' ))."');";
if ( $debug ) {
  echo "sql: ";print_r($sql); echo"<br />";
}
$database->setQuery( $sql );
if (!$database->query()) {
echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>
";
}
?>
Bob
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
User avatar
GreyHead
Platinum Boarder
 
Posts: 3438
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Re:Show data not working?

Postby jpc0480 on Sun Jul 06, 2008 4:04 pm

GreyHead wrote:Hi jpc0480,

Your form appears to work OK for me. I did have to add 'addslashes' to the textarea input, mainly because I typed some junk in there. Here's the Autogenerated code I ended up with - including some debug code.
Code: Select all
<?php
$database =& JFactory::getDBO();
srand((double)microtime()*10000);
$inum = "I" . substr(base64_encode(md5(rand())), 0, 16);
$sql = "INSERT INTO #__chronoforms_67
VALUES  (
'' ,
  '".$inum."',
'". date('Y-m-d')." - ".date("H:i:s")."', '".$_SERVER['REMOTE_ADDR']."' ,
'".JRequest::getVar('name','', 'post', 'string', '' )."' ,
'".JRequest::getVar('company','', 'post', 'string', '' )."' ,
'".JRequest::getVar('email','', 'post', 'string', '' )."' ,
'".JRequest::getVar('phone','', 'post', 'string', '' )."' ,
'".JRequest::getVar('website','', 'post', 'string', '' )."' ,
'".JRequest::getVar('url','', 'post', 'string', '' )."' ,
'".JRequest::getVar('complete','', 'post', 'string', '' )."' ,
'".JRequest::getVar('em_svc','', 'post', 'string', '' )."' ,
'".JRequest::getVar('hosting','', 'post', 'string', '' )."' ,
'".JRequest::getVar('other','', 'post', 'string', '' )."' ,
'".JRequest::getVar('redesign','', 'post', 'string', '' )."' ,
'".JRequest::getVar('maintenance','', 'post', 'string', '' )."' ,
'".JRequest::getVar('ecommerce','', 'post', 'string', '' )."' ,
'".JRequest::getVar('time','', 'post', 'string', '' )."' ,
'".JRequest::getVar('method','', 'post', 'string', '' )."' ,
'".addslashes(JRequest::getVar('description','', 'post', 'string', '' ))."');";
if ( $debug ) {
  echo "sql: ";print_r($sql); echo"<br />";
}
$database->setQuery( $sql );
if (!$database->query()) {
echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>
";
}
?>
Bob


Thank you! At first it didn't work and I checked the code and had to change the table it was posting to. Once I did that, everything worked fine. Thanks again!
jpc0480
Fresh Boarder
 
Posts: 10
Joined: Fri Jul 04, 2008 1:11 am
Location: Charleston, SC,

Re:Show data not working?

Postby GreyHead on Mon Jul 07, 2008 8:16 am

Hi jpc0484,

Glad it worked for you - I should have remembered to point out the table name - you probably haven't got 67 forms yet.

Bob
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
User avatar
GreyHead
Platinum Boarder
 
Posts: 3438
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Re:Show data not working?

Postby jpc0480 on Mon Jul 07, 2008 10:59 am

No problems. It was an easy fix.
jpc0480
Fresh Boarder
 
Posts: 10
Joined: Fri Jul 04, 2008 1:11 am
Location: Charleston, SC,


Return to ChronoForms Questions & Answers

Who is online

Users browsing this forum: Google [Bot], GreyHead, koolie, MSN [Bot], MSNbot Media, revive and 5 guests

cron