MYSQL error when adding file to a newly created set
Permalink
Hi All,
I've managed to upload an image & import it into the file manager, create a new set (with the code), though when I try and add the file to the newly made set I get the following MYSQL error:
mysql error: [1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? LIMIT 1' at line 1] in EXECUTE("select count(fID) from FileSetFiles where fsID = ? LIMIT 1")
I'm trying to get this going with the code suggested here:http://www.concrete5.org/documentation/developers/files/grouping-fi...
I have tried just the file object too (which the docs say is fine):
Any suggestions on what I can do here??
I've managed to upload an image & import it into the file manager, create a new set (with the code), though when I try and add the file to the newly made set I get the following MYSQL error:
mysql error: [1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? LIMIT 1' at line 1] in EXECUTE("select count(fID) from FileSetFiles where fsID = ? LIMIT 1")
I'm trying to get this going with the code suggested here:http://www.concrete5.org/documentation/developers/files/grouping-fi...
$fs->addFileToSet($resp->fID);
I have tried just the file object too (which the docs say is fine):
$fs->addFileToSet($resp);
Any suggestions on what I can do here??
This is what I've got at the mo, slightly amended from the concrete5 form block controller.
// concrete5 form block code (modified slightly) for the right image field $tmpFileIds=array(); $resp = $fi->import($_FILES['image']['tmp_name'], $_FILES['image']['name']); if (!($resp instanceof FileVersion)) { switch($resp) { case FileImporter::E_FILE_INVALID_EXTENSION: $errors['fileupload'] = t('Invalid file extension.'); echo 'invalid file ext'; break; case FileImporter::E_FILE_INVALID: $errors['fileupload'] = t('Invalid file.'); echo 'invalid file'; break; } }else{
Viewing 15 lines of 26 lines. View entire code block.
That else section looks like it has some errors. Like around the FileSet::getByID() part.
Turned out I didn't need the following line. Works fine now thanks!!
$fs = $fs->getByID($this->addFilesToSet);
Indeed. Glad to hear you got it sorted.
Best Wishes,
Mike
Best Wishes,
Mike
Did you add that file set SQL code or did you just get that error?
Are you sure you are getting a file set to begin with. You might want to check to make sure like this.