close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

DA 207 database error handling

Thread began 6/17/2010 5:18 pm by rick178787 | Last modified 6/21/2010 3:18 pm by Jimmy Wu | 814 views | 5 replies |

rick178787

DA 207 database error handling

in MySql I set up an index with the attribute of "unique" on one of the columns to keep from getting duplicate entries. It works as it should and when I enter a dupe the Insert.php DA 207 Wizard handles the error with the rather cryptic:

Duplicate entry 'books' for key 2

where "books" is the duplicate word I tried to add.

Usually in php I see lines of code dealing with error handling but I don't see where this command is generated. I suppose this is coming from SSI but I can't backtrack far enough to locate the code and put a more user friendly message in.

Any ideas?

Rick

Sign in to reply to this post

Jimmy Wu

This looks like the error generated by MySQL. The code written by DataAssist will have the query to insert like this:
mysql_query(<query here>) or die(mysql_error());

If there's an error, then it displays the mysql_error(). If you wanted to output something other than the default mysql_error, you would want to check the mysql_errno() and output different messages based on the error number that is returned.

For that particular error, the error number is 1062:
error-messages-server.html

As this is something that requires custom coding, it is not supported, so I can only point you in the right direction.

Sign in to reply to this post

rick178787

JW, okay I understand. But I'd think this is a rather common problem (preventing duplicates in a database). Is there a more elegant way to trap these that I'm not seeing?

How would WA suggest this be done?

Sign in to reply to this post

Jimmy Wu

Using the error code that is returned by MySql as I suggested in the previous post would be what I would recommend.

Sign in to reply to this post

rick178787

Okay, just checking. I'm famous for bulling ahead with the least elegant solution. my last shop was cold fusion/ms sql, so data error trapping was a bit easier/different.

thanks.

Sign in to reply to this post

Jimmy Wu

No problem. If you run into any additional issues, feel free to open a new thread.

Sign in to reply to this post

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