Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
|
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases 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 September 28th, 2004, 07:31 PM
Authorized User
 
Join Date: Sep 2004
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Default No Duplicate Records Error

I have a MySQL database, with one table: tblquestion.
The table has a unique index on finQuestion (the question #).
I know the unique index works, because if I try to run an insert query in the msqlld window, it rejects it and says its a duplicate entry for the above key.

So, I ran some PHP code with the following line in it:
$vrrQuery = mysql_query($vtxSqlInsert, $vrlMySql) or die("Couldn't Insert Record<br>\n".mysql_error());
The connection was alright, database selection was alright.
This block of code I'm talking about inserts a bunch of questions into tblquestion with the #'s from 1-60 (finQuestion).
If I call the php code again, it DOES NOT DIE AT THE INSERT STATEMENT?
It just keeps going happily!
So, I'm stunned.
I'm used to errors happenning in MS Access, so I wanted to see what the MySQL error fed back to PHP would look like.
Can somebody tell me what is going on?
I wanted to get a head's up to see how to trap for duplicate entries in future forms' I design.






__________________
Database Agreements





Similar Threads
Thread Thread Starter Forum Replies Last Post
How Not To Insert Duplicate Records GailCG ASP.NET 2.0 Basics 5 November 25th, 2008 12:19 PM
duplicate records vanitha SQL Server 2000 4 June 2nd, 2007 04:35 PM
duplicate records vanitha Reporting Services 2 May 31st, 2007 01:54 AM
Delete Duplicate Records prasanta2expert SQL Server 2000 9 December 15th, 2006 10:44 PM
Duplicate Records mrookey Dreamweaver (all versions) 1 April 15th, 2005 11:23 AM





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