Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > Adobe Web Programming > Dreamweaver (all versions)
|
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Dreamweaver (all versions) section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 27th, 2006, 12:55 PM
Registered User
 
Join Date: Dec 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Duplicate database entry redirection error page

 Hi,

Im trying to set up a system where a user can register for a certain file. I have set up a database where their username and file selection (from a drop down menu) are inserted into a table (made in mysql) upon clicking register. However, I dont want them to be able to register twice for the same thing, i.e. I dont want username + file duplicates. So I have made the username and file fields in my table as primary keys, thus when a none unique entry is made i.e. a duplicate, I want the user to be redirected to an error page telling them their selection is invalid.
Ok, I know you can use the Check New Username feature under server behaviours but the problem is that it only accepts one field to check against - and either choice username or file still redirect me to exception report internal error page - not very user friendly!

Is there a way to get the condition on both username and file via html code or any other means, and redirect to a custom error page to tell the user to try again? Any help would be extremely welcome. Thanks!

 
Old December 29th, 2006, 01:28 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 479
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via MSN to surendran Send a message via Yahoo to surendran
Default

hai,
you can use ajax, it will contact with server in html page, so try to do in ajax, if u want to get any help regading ajax, visit my msn space.

surendran
(Anything is Possible)
http://ssuren.spaces.msn.com
 
Old December 29th, 2006, 08:26 AM
Registered User
 
Join Date: Dec 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thankyou for your reply! I will certainly have a look at AJAX.

However, I found a way to create a custom error message, as opposed to the http 500 error page. This isnt the absolute solution to redirecting to a custom error page specific to a duplicate entry error, but is an error page for whatever error crops up, and so overrides the default http 500 page!

All you need to do, if you are using Java, is to insert errorPage="yourcustomerrorpage.jsp" into:

<%@page language="java" import="java.sql.*"%> (top of the code)

So that you get...

<%@page language="java" import="java.sql.*" errorPage="yourcustomerrorpage.jsp"%>

Obviously, yourcustomerrorpage, is a page you made yourself!

This worked for me, hope it helps other people too!

 
Old December 29th, 2006, 10:17 AM
Registered User
 
Join Date: Dec 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Surendran,

I had a look on your site, but couldnt find any info relating to my duplicate entry problem?! Whereabouts is this info?

Thanks






Similar Threads
Thread Thread Starter Forum Replies Last Post
Check for Duplicate Records in Data Entry Form roznix Access VBA 5 June 7th, 2012 08:53 AM
Checking for duplicate entry in Database sharon5469 ASP.NET 1.0 and 1.1 Basics 1 November 18th, 2007 06:08 PM
Duplicate database entry redirection error page EmWebs Access ASP 0 December 27th, 2006 12:54 PM
avoid duplicate entry of records mikersantiago Classic ASP Basics 4 February 10th, 2005 09:14 PM
deleting only 1 duplicate entry qwjunk Classic ASP Databases 3 February 2nd, 2004 11:45 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.