I have a fresh install of Drupal 7.23 along with some contributed modules including Webform 7.x-3.19 and Webform Report 7.x-1.0. Once installed, I created a new webform and submitted one test submittal to get data. I can view the submission's data without a problem in the Webform module itself.
However when I created a report with Webform Report with just the First and Last Name and then go to view the report, I get this error message:
PDOException: SQLSTATE[42000]: [Microsoft][SQL Server Native Client 11.0][SQL Server]Incorrect syntax near the keyword 'user'.: SELECT w.nid, c.name, c.cid, d.nid, d.sid, d.data, s.uid, u.name as user, s.submitted, s.remote_addr FROM {webform} w LEFT JOIN {webform_submitted_data} d ON w.nid = d.nid LEFT JOIN {webform_component} c ON d.cid = c.cid LEFT JOIN {webform_submissions} s ON d.sid = s.sid LEFT JOIN {users} u ON s.uid = u.uid WHERE d.nid = c.nid AND c.nid = s.nid AND s.nid = :nid ORDER BY d.sid, c.cid, d.no; Array ( [:nid] => 1 ) in _webform_report_get_submissions() (line 253 of mysite\sites\all\modules\webform_report\webform_report.inc).
It refers to Line from the webform_report.inc file, which is this:
function _webform_report_get_submissions($node) {
if (isset($node->wnid)) {
return db_query("
SELECT w.nid, c.name, c.cid, d.nid, d.sid, d.data, s.uid, u.name as user, s.submitted, s.remote_addr
FROM {webform} w
LEFT JOIN {webform_submitted_data} d ON w.nid = d.nid
LEFT JOIN {webform_component} c ON d.cid = c.cid
LEFT JOIN {webform_submissions} s ON d.sid = s.sid
LEFT JOIN {users} u ON s.uid = u.uid
WHERE d.nid = c.nid
AND c.nid = s.nid
AND s.nid = :nid
ORDER BY d.sid, c.cid, d.no", array(':nid' => $node->wnid)); //<<<---- Line 253
}
else {
return NULL;
}
}
I'm familiar with SQL but still learning on Drupal and PHP. If anyone can see why this isn't working, I'd appreciate the knowledge.
Comments
Comment #1
katannshaw CreditAttribution: katannshaw commentedUPDATE:
I just upgraded Webform from 7.x-3.19 > 7.x-4.0-beta1 and the same error appears when trying to view a report. I can still edit it without a problem, although it's unusable.
Comment #2
TBarina CreditAttribution: TBarina commentedTry upgrading to latest dev version and also see https://drupal.org/node/2183373.
I'm running it flawlessly at my site.
Best regards
Comment #3
TolliSysDev CreditAttribution: TolliSysDev commentedI am experiencing the same issue and can't view any webform reports without it crashing. Is there a fix for this issue? [RESOLVED - see my comment below]
Thanks!
Comment #4
TolliSysDev CreditAttribution: TolliSysDev as a volunteer and commented[UPDATE]
Doubling back - in case anyone else runs into this issue. This MS SQL syntax error is resolved by adding brackets around 'user' in the db query select statement as noted below:
SELECT w.nid, c.name, c.cid, d.nid, d.sid, d.data, s.uid, u.name as [user], s.submitted, s.remote_addr
Comment #5
TolliSysDev CreditAttribution: TolliSysDev as a volunteer and commentedComment #6
TolliSysDev CreditAttribution: TolliSysDev as a volunteer and commented