cformsII Support Forum
Current User: Guest *Frequently Asked Questions*
Search 
Search Forums:


 




How To Pull Data?

Add a New Topic Reply to Post
Post

CyberWoolf - Guest

5:49 am - August 12, 2008

Please replace the ??? with your data!

  • Your URL: http://private
  • The browser used: NA
  • cforms version: 2.6
  • Your Wordpress version: 2.6

I am working with cforms and have a custom plugin that works with cforms.  It lists all the submitted data in a list format (by date).  I am trying to get it add the Company name before the date.  I'm a little baffled and was wondering if I could get some help to figure out why it's not showing up (the company name.. everything else works fine)

------------

    if($userdata->user_level == "10"){$selectby = FALSE;}else{$selectby = "WHERE u_id = '$userdata->ID'";}
    $date = $wpdb->get_results("SELECT DISTINCT(sdate) FROM $wpdb->cformsdata $selectby");
       $company = $wpdb->get_results("SELECT field_val FROM $wpdb->cformsdata WHERE u_id = '$userdata->ID' AND field_name = 'Company' AND date = '$dates->sdate'");
     foreach ($date as $dates)
     
     {

      echo "<a href=\"{$_SERVER['REQUEST_URI']}&by_date=$dates->sdate\">". $company->field_val .$dates->sdate."</a><br />
      ";
     }

Oliver - Admin

7:37 am - August 12, 2008

posts 3656

Hard to tell without seeing the form (& field structure), it generally looks good.

I'd start with building the SQL in a SQL editor until it works and then build the PHP around it.

$company = $wpdb->get_results("SELECT field_val FROM...

may return more than one entry!

And isn't it supposed to be inside the foreach LOOP ($dates is not set earlier!)?

CyberWoolf - Guest

8:48 pm - August 12, 2008

It is defined earlier :-)  I didn't to mess up the post by posting a really long file :-D  so I just added the code that was relavent.  It is supposed to be in the foreach loop, I was putting it in different spots to see if that would work and didnt put it back heh sorry!  I will play around some more with it and let you know what I figure out!


Thanks so much for the quick response!  I really love this plugin.

Classic - Guest

8:52 pm - August 13, 2008

Hey CyberWoolf, what's the name of your custom plugin? I've been looking for a plugin that can pull data from cforms.

Thanks in advance!

CyberWoolf - Guest

1:55 am - August 14, 2008

Well it was custom build for this specific system :-)  Sorry!

Add a New Topic Reply to Post


Reply to Topic: How To Pull Data?
PLEASE READ THE FAQs FIRST! THANK YOU.

NOTE: New Posts are subject to administrator approval before being displayed

Guest Name (Required):

Guest EMail (Required):

Guest URL (required)

Math Required!
What is the sum of: 11 + 5        (Required)

Topic Reply:


 
© Simple:Press Forum - Version 3.1.3 (Build 356)