SQL Error adding block
Permalink Browser Info Environment
Made my first block with this version, and added the block to a page to test. Filled out block form, clicking Add, and I get an SQL exception:
An exception occurred while executing 'INSERT INTO btMulServiceListingTwo (bID, title, desc, image, intlink, intlink_text, extlink, extlink_text, align, bgcolor, faicon, icoalign, anim) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params ["16", "Test", "test<\/p>", "1", "0", "", "", "", "", "", "", "", ""]: SQLSTATE[42000]: Syntax error or access violation: 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 'desc, image, intlink, intlink_text, extlink, extlink_text, align, bgcolor, faico' at line 1
Any ideas? Other standard blocks add to the page.
An exception occurred while executing 'INSERT INTO btMulServiceListingTwo (bID, title, desc, image, intlink, intlink_text, extlink, extlink_text, align, bgcolor, faicon, icoalign, anim) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params ["16", "Test", "test<\/p>", "1", "0", "", "", "", "", "", "", "", ""]: SQLSTATE[42000]: Syntax error or access violation: 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 'desc, image, intlink, intlink_text, extlink, extlink_text, align, bgcolor, faico' at line 1
Any ideas? Other standard blocks add to the page.
Type: | Discussion |
---|---|
Status: | Resolved |
Hi there,
I do know what happened here. For the "Description" input, you've chosen a variable called "desc". This actually is a SQL statement. There is already a blacklist and that will add a numeric value to your slug (like desc1), to avoid this from happening. The "desc" is not in this blacklist though, so I will be adding this. Same goes for "asc" (so ascending and descending). Meanwhile, do not use these 2 SQL statements as variable name, and you should be good to go!
Makes sense? :)
Kind regards,
Ramon
I do know what happened here. For the "Description" input, you've chosen a variable called "desc". This actually is a SQL statement. There is already a blacklist and that will add a numeric value to your slug (like desc1), to avoid this from happening. The "desc" is not in this blacklist though, so I will be adding this. Same goes for "asc" (so ascending and descending). Meanwhile, do not use these 2 SQL statements as variable name, and you should be good to go!
Makes sense? :)
Kind regards,
Ramon
Yes, that does make sense. I actually thought about 'desc' when I made the variable name, but thought, "Oh, that shouldn't matter, this is in the PHP." Oops. Lesson learned.
Great package! Looking forward to working with it. Thanks again for all your efforts.
Great package! Looking forward to working with it. Thanks again for all your efforts.
After I will release the new version, you can add "desc" as variable name. It will get converted (behind the scenes) to desc_1. This way, all SQL functions will remain valid and everything will work as it should. But best thing to do is to just write the full name (description in this case). Also reads better in the PHP code eventually.
Hope you will fall in love with Block Designer. I'm 100% certain it will save you loads of valuable time.
Kind regards,
Ramon
Hope you will fall in love with Block Designer. I'm 100% certain it will save you loads of valuable time.
Kind regards,
Ramon
Already in love with it, and looking to make extensive use of it!
When you have the time, please leave a review. That will help others, you AND me a lot :)
Kind regards,
Ramon
Kind regards,
Ramon
Dec 29, 2017
Note: Also don't use "interval" as a slug name for a field. I think that was the culprit.
Note: Also don't use "interval" as a slug name for a field. I think that was the culprit.
* double post
I don't know what happened before. I uninstalled that block (that was giving sql error in original post), deleted it, went back and re-built it and it adds and outputs to the page now.