Category Archives: sql

Getting ‘doesn’t have a default value’ from MySQL (MariaDB)?

Solution for me from ideas at https://stackoverflow.com/questions/15438840/mysql-error-1364-field-doesnt-have-a-default-values and https://www.farbeyondcode.com/Solution-for-MariaDB-Field–xxx–doesn-t-have-a-default-value-5-2720.html was to remove ‘STRICT_TRANS_TABLES’ from my.cnf. So I ended up with the following in /usr/local/mysql/my.cnf: [mysqlnd] sql_mode=NO_ENGINE_SUBSTITUTION

Posted in osx, sql | Tagged , | Leave a comment

REPLACE instead of SELECT and then INSERT or UPDATE

It’s nice that MySQL has the replace query so instead SELECTing to check if the data exists in the DB and than INSERTing or UPDATEing I just need to write one query. So instead this: $q = “SELECT id FROM … Continue reading

Posted in sql | Leave a comment