close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Tutorial: Manage relational tables get error: Field 'ItemGenreID' doesn't have a default value

Thread began 7/02/2020 9:52 am by Jonas | Last modified 7/15/2020 6:02 pm by Ray Borduin | 52 views | 7 replies |

Jonas

Tutorial: Manage relational tables get error: Field 'ItemGenreID' doesn't have a default value

I've followed the tutorial: Manage relational tables (http://www.webassist.com/community/tutorials/view_tutorial.php?tutorial=Manage-relational-tables) several times now, exactly as it says each time. But get error message: "Field 'ItemGenreID' doesn't have a default value" when I press the insert button.
Why so?

Attached Files
items_insert.php
items_update.php
Sign in to reply to this post

Ray BorduinWebAssist

This means you have a column named ItemGenreID in your database that doesn't allow null and doesn't have a default value set in the database and you aren't setting a value when you do the insert. You would either have to update the database to allow null for that column, give it a default value, or set a value when you do the insert.

Sign in to reply to this post
Did this help? Tips are appreciated...

Jonas

If so, can you please update the tutorial - because, as I told you before - I have followed the tutorial and used the database included.

Sign in to reply to this post

Ray BorduinWebAssist

The tutorial .sql file for creating the database has a default set for the ItemGenreID column in the table:

CREATE TABLE `itemgenres` (
`ItemGenreID` int(10) NOT NULL auto_increment,

For some reason your table import didn't take the auto_increment setting when you ran the .sql file to create the database tables. Update that column to be an auto_increment in your database like the tutorial should have done and it should fix this issue.

Sign in to reply to this post
Did this help? Tips are appreciated...

Jonas

Unfortunately, I do not get it to work. Insert does not work, but update works. ItemGenreItemID is not written for any reason.
I have struggle with this for a couple of days now, and I want it to work.

Sign in to reply to this post

Ray BorduinWebAssist

Your server behaviors are in the wrong order on the insert page. The single insert has to be above the multiple insert since the multiple insert uses the Session variable saved when the insert takes place.

Move lines 33-49 up above line 3 on the insert page and that should correct that problem.

Sign in to reply to this post
Did this help? Tips are appreciated...

Jonas

Oh well, beginner mistake! Now that's more like it. But one problem remains. How do I delete everything that is connected? When I now delete an Item - this is deleted from the Item table, but not the links in the itemgenres table.

Sign in to reply to this post

Ray BorduinWebAssist

Apply a second delete server behavior to delete the items from the second table.

Sign in to reply to this post
Did this help? Tips are appreciated...

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...