« Auto-notification of file download | Main | Karmic Repository Gone »

November 29, 2011

Query for Webform Submissions - Snippets

$ip = '::1';

// execute sql using db_query
$sid_sql = db_query("SELECT n.sid FROM drupal_webform_submissions n WHERE n.remote_addr = '%s' ", $ip);

// fetch database results in an array
$results = array();
while ($row = db_fetch_array($sid_sql)) $results[] = $row;

//get last sid as an array $last_sid["sid"]
$last_sid = end($results);

// query to retrieve submitted webform data
$webform_sql = db_query("SELECT data FROM drupal_webform_submitted_data n WHERE n.sid = '%s' ", $last_sid["sid"]);

// fetch database results in an array
$webform_submission = array();
while ($row = db_fetch_array($webform_sql)) $webform_submission[] = $row;

/*put $webform_submission information into message body*/

Notes:

Another option
is to use a webform hook but this returns all of the submissions:

module_load_include('inc', 'webform', 'webform_submissions');
$values = webform_get_submissions($nid, null, $user->uid, 1);

Posted by kkwaiser at November 29, 2011 03:15 PM

Trackback Pings

TrackBack URL for this entry:
http://mblog.lib.umich.edu/mt-bin/mt-tb.cgi/2309

Listed below are links to weblogs that reference Query for Webform Submissions - Snippets:

» イルビゾンテ セール from イルビゾンテ セール
Just in case you were unaware, Kate Spade has new arrivals and it is all about “Places to travel, people to see! ” First stop, Brighton, England! [Read More]

Tracked on February 9, 2014 08:26 AM

» イルビゾンテ バッグ from イルビゾンテ バッグ
For those who were unaware, Kate Spade has new arrivals in fact it i all about “Places to go, people to see! ” First stop, Brighton, England! [Read More]

Tracked on February 9, 2014 01:05 PM

» ヴィトン バッグ from ヴィトン バッグ
Data Discussions: Query for Webform Submissions - Snippets [Read More]

Tracked on February 18, 2014 04:53 PM

» gucci outlet online from gucci outlet online
[url=http://www.pradashoes-outlet.com]prada shoes[/url] [url=http://www.pradashoes-outlet.com]prada outlet[/url] [url=http://www.pradashoes-outlet.com]prada sneakers[/url] [url=http://www.pradashoes-outlet.com]www.pradashoes-outlet.com[/url] [Read More]

Tracked on February 20, 2014 01:30 PM

» prada shoes from prada shoes
[url=http://www.pradashoes-outlet.com]prada shoes[/url] [url=http://www.pradashoes-outlet.com]prada outlet[/url] [url=http://www.pradashoes-outlet.com]prada sneakers[/url] [url=http://www.pradashoes-outlet.com]www.pradashoes-outlet.com[/url] [Read More]

Tracked on February 20, 2014 03:47 PM

» Nouveau maillot manchester united 2014 officiel from Nouveau maillot manchester united 2014 officiel
Say, you got a nice blog article.Really looking forward to read more. Want more. [Read More]

Tracked on March 7, 2014 03:07 PM

» jordan 13 from jordan 13
Data Discussions: Query for Webform Submissions - Snippets [Read More]

Tracked on March 9, 2014 08:25 AM

» サマンサタバサ セール 2014 from サマンサタバサ セール 2014
jobobqidblcvametllvvnfgn lenen zonder bkr fffdeldlfa gkvhmskdkbtftkrbefnhsadvi lenen zonder bkr toetsing glllffggk lkgvmhvaafsflkhmhjovea lenen fgjebajelj kcptqfkakdrkiahdkahkgq hypotheek deejeefjde spcnoahiijrphmmdfviaqmgg migraine edjfejjfd [Read More]

Tracked on March 14, 2014 10:55 PM

» トゥミ アウトレット from トゥミ アウトレット
Hi there I like your post [Read More]

Tracked on March 14, 2014 10:55 PM

» auto from auto
Data Discussions: Query for Webform Submissions - Snippets [Read More]

Tracked on April 5, 2014 02:51 AM

» 1 from 1
Data Discussions: Query for Webform Submissions - Snippets [Read More]

Tracked on April 6, 2014 08:54 AM

» nike air max 1 from nike air max 1
Data Discussions: Query for Webform Submissions - Snippets [Read More]

Tracked on April 16, 2014 08:29 AM

» Cheap louis vuitton from Cheap louis vuitton
Data Discussions: Query for Webform Submissions - Snippets [Read More]

Tracked on April 20, 2014 01:44 AM

Comments

Login to leave a comment. Create a new account.