function _webform_fetch_submission in Webform 5
Fetch a specified submission for a webform node.
3 calls to _webform_fetch_submission()
- webform_submission_edit in ./
webform.module - Editable display of a webform submission.
- webform_submission_view in ./
webform.module - View-only presentation of the webform filled with a particular submission.
- webform_view in ./
webform.module - Implementation of hook_view().
File
- ./
webform.inc, line 148
Code
function _webform_fetch_submission($sid, $nid) {
$submission = array();
$query = 'SELECT s.*, sd.cid, sd.no, sd.data ' . 'FROM {webform_submitted_data} as sd ' . 'LEFT JOIN {webform_submissions} as s on (sd.sid = s.sid) ' . 'WHERE sd.sid = %d AND s.nid = %d';
$res = db_query($query, $sid, $nid);
$recs = db_num_rows($res);
if ($recs >= 1) {
$row = db_fetch_array($res);
$submission['nid'] = $row['nid'];
$submission['sid'] = $row['sid'];
$submission['uid'] = $row['uid'];
$submission['remote_addr'] = $row['remote_addr'];
$submission['submitted'] = $row['submitted'];
while ($row) {
$submission['data'][$row['cid']]['value'][$row['no']] = $row['data'];
$row = db_fetch_array($res);
}
}
return $submission;
}