# What were bugs on activities page and how did I solve them? ###### tags: `debug` `activites` ## The input text cannot be saved When click on discussion prompt. ### 🐞Bugs: syntax error - found on /components/discussion/submit.php the query is not called successfully becuase there is syntax error reported by phpMyadmin will query directly with it. The query string look like this: ### 💡Solutions - Use better practice to write sql. [This article](https://towardsdatascience.com/10-best-practices-to-write-readable-and-maintainable-sql-code-427f6bb98208) might help. ## The input data of discussion prompt in each activity item is not showing on the page itself ### 🐞Bugs Because when we store the data (see `discussion` table), there's nothing pointed to a certain activity, we won't be able to call/know which discussion is related to which activity. Also, the query was incorrect because when calling `$_GET['tertiary_folder']` was empty string, so the related_id of certain activities cannot be stored. ### :label: Solutions: Based on the bug, the solution would be store the answer with `related_id`. ==NOTE: duplicate the row from `activities` table to `activities_update` bt [this method](https://www.w3schools.com/sql/sql_insert_into_select.asp#:~:text=The%20INSERT%20INTO%20SELECT%20statement,the%20target%20table%20are%20unaffected.)== ```php Field 'value_zone' doesn't have a default value; Field 'hours_a_week' doesn't have a default value; Unknown column 'numerical_zone' in 'field list' ``` ## Activities data is not working on multiple sections ### 🐞Bugs #### 1. Unavaliable to insert/save activities to database :bulb:Found: when setting on the database is STRICT mode, it would return ``` sql Field 'display_name' doesn't have a default value ``` :label: Solutions: Change settings. Before change anything, run `SELECT @@GLOBAL.sql_mode`, to check if it return `STRICT_TRANS_TABLES` There are 2 solutions. - set default values to `NULL` (chosen solution) - Try running SET GLOBAL sql_mode='' or edit your my.conf to make sure you aren't setting STRICT_ALL_TABLES or the like. [reference](https://stackoverflow.com/questions/18751291/mysql-error-1364-field-display-name-doesnt-have-default-value)