<p>This issue came as a result of the MySQL DB <code>sql_mode</code> including the <code>NO_AUTO_VALUE_ON_ZERO</code> mode which affects how <code>auto_increment</code> columns work. When trying to create a new row entry it will only <code>auto_increment</code> if <code>null</code> is passed.</p>

<p>Full explanation here:</p>

<p><a href="http://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_no_auto_value_on_zero" rel="nofollow">http://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_no_auto_value_on_zero</a></p>

<p>This setting matched with the way the controller's <code>actionSaveDefault</code> function was setting the id to a blank value rather than a <code>null</code> value caused it to trigger this DB behavior of writing a 0 rather than <code>auto_increment</code>.</p>

<p>While the cause of the issue is not Craft or SproutSEO specific, this answer might help anyone else with the issue.</p>

<ol>
<li>Check your MySQL DB <code>sql_mode</code> </li>
<li>If, <code>NO_AUTO_VALUE_ON_ZERO</code> is set make sure you're passing <code>null</code> if you want it to <code>auto_increment</code></li>
</ol>

CC BY-SA 3.0
2016-01-11T20:38:08.423Z
2016-01-11T20:38:08.423Z
Taylor
<p>After creating a default meta entry in Sprout SEO. Any subsequent updates aren't saved and I get an error message "Couldn't save the default"</p>

<p>Using:</p>

<ul>
<li>Craft 2.4.2725</li>
<li>Sprout SEO 1.1.1</li>
</ul>

<p>Has anyone else come across this?</p>

CC BY-SA 3.0
2015-12-22T20:20:32.103Z
Do you see any related errors in your logs (craft/storage/runtime/logs/sproutseo.log)?
Ben Parizek
CC BY-SA 3.0
2015-12-22T20:47:11.043Z
I don't see a sproutseo.log but I do see craft.log. Not sure what to look for inside the craft log with no obvious errors.
Taylor
CC BY-SA 3.0
2015-12-23T21:36:16.047Z
The only thing I have been able to track down is that for some reason the id column of the sproutseo_defaults  table wasn't auto incrementing. The first entry would result in a 0. haven't been able to figure out why.
Taylor
<plugin-sproutseo>
Sprout SEO: Getting error on save, preventing updating "default" meta data
# Sprout SEO: Getting error on save, preventing updating "default" meta data

(Asked by: username_0 on 2015-12-22)

After creating a default meta entry in Sprout SEO. Any subsequent updates aren't saved and I get an error message "Couldn't save the default"

Using:

* Craft 2.4.2725
* Sprout SEO 1.1.1

Has anyone else come across this?

**Tags:** plugin-sproutseo

> **Comments:**
> **username_1**: Do you see any related errors in your logs (craft/storage/runtime/logs/sproutseo.log)?  
> **username_0**: I don't see a sproutseo.log but I do see craft.log. Not sure what to look for inside the craft log with no obvious errors.  
> **username_0**: The only thing I have been able to track down is that for some reason the id column of the sproutseo_defaults  table wasn't auto incrementing. The first entry would result in a 0. haven't been able to figure out why.  

---

## 1 answers

### Answer by username_0 on 2016-01-11. Score: 2

This issue came as a result of the MySQL DB `sql_mode` including the `NO_AUTO_VALUE_ON_ZERO` mode which affects how `auto_increment` columns work. When trying to create a new row entry it will only `auto_increment` if `null` is passed.

Full explanation here:

<http://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_no_auto_value_on_zero>

This setting matched with the way the controller's `actionSaveDefault` function was setting the id to a blank value rather than a `null` value caused it to trigger this DB behavior of writing a 0 rather than `auto_increment`.

While the cause of the issue is not Craft or SproutSEO specific, this answer might help anyone else with the issue.

1. Check your MySQL DB `sql_mode`
2. If, `NO_AUTO_VALUE_ON_ZERO` is set make sure you're passing `null` if you want it to `auto_increment`


---

