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

Insert and Update Failed

Thread began 5/07/2021 6:46 am by FPhu61701534 | Last modified 5/10/2021 8:47 am by Ray Borduin | 37 views | 3 replies |

FPhu61701534

Insert and Update Failed

I have 3 forms which used to work but are now throwing errors.
Background: There was a server consolidation exercise by my hosting provider a few days ago. The hostname of the WebAssist database connection was thus changed to the new database server's IP address. Since then, pages that insert and update database records failed. However, pages that generate recordsets are still working. The service provider later changed the hostname to "localhost". But the problem persists.

I re-uploaded the WebAssist files to the server several times but the problems persist. It's strange why the error message keeps saying a certain field does not have a default value, which didn't happen before.

May I know what is causing the problem?

Sign in to reply to this post

Ray BorduinWebAssist

You either have to
1) update the database to set a default value for nameProduct, or set it to allow NULL.
2) update your insert and update server behavior to set a value if blank to "blank" instead of "default", since there is no default set in the database.

The line of code in question would be:

$UpdateQuery->bindColumn("nameProduct", "s", "".((isset($_POST["txtNameProduct"]))?$_POST["txtNameProduct"]:"") ."", "WA_DEFAULT");

it would become:

$UpdateQuery->bindColumn("nameProduct", "s", "".((isset($_POST["txtNameProduct"]))?$_POST["txtNameProduct"]:"") ."", "WA_BLANK");

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

FPhu61701534

There are instances whereby a form field is filled with null data from the database because there wasn't any data inserted previously. Do I set it to "WA_BLANK"? How come this problem didn't occur prior to the server consolidation? Is it because something have "broken" somewhere?
The "WA_DEFAULT" is set by DataAssist by default. Hence I never thought it needs/has to be changed if there is a null record.

Sign in to reply to this post

Ray BorduinWebAssist

It has to be a database settings change that doesn't allow you to leave it as default. Usually if a column allows null, then it will use null by default and wouldn't error. "WA_BLANK" would use an empty string "WA_NULL" would use null, and "WA_DEFAULT" tells the database to use its default value for that column. If the database doesn't have a default then it throws the error.

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...