Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 28th, 2004, 07:31 PM
Authorized User
Join Date: Sep 2004
Location: Nanaimo, BC, Canada.
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
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 09:43 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.