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

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Insert page returns error 'Duplicate entry '0' for key 'PRIMARY''

Thread began 10/24/2011 10:49 am by CheopisIV | Last modified 2/23/2012 9:47 am by Jason Byrnes | 4461 views | 16 replies |

CheopisIVBeta Tester

Insert page returns error 'Duplicate entry '0' for key 'PRIMARY''

Hello, I'm using Security Assist to develop a multi-tiered user system, and it's been a huge time saver and flawless until today (Great plugin!!).

I've added some different viewable fields for user levels and also added some spry validation to make sure data is entered correctly. Today, I'm testing the Insert User function and keep getting this error;

Duplicate entry '0' for key 'PRIMARY'

so my script isn't checking and advancing the User ID any more. I haven't edited the main script so I don't know where it's been broken or what caused it. I'll attach the file I'm using if anyone can assist me with it.

Sign in to reply to this post

Jason ByrnesWebAssist

the VisitorID column of your database should be set to be an Auto Increment key to force the database to give it a value.


this error happens whens you do not set the primary key column to auto increment.

Sign in to reply to this post

CheopisIVBeta Tester

:)

Just found that myself as well, thanks for the quick response. I must have accidentally changed it in my modifications of the db. Code and Plugin are still working flawlessly!

Sign in to reply to this post

erinlima318673

Insert page returns error 'Duplicate entry '0' for key 'PRIMARY''

Having the same issue - the extension has worked flawlessly for months - until today.
I get an error message that reads: Duplicate entry '127' for key 1

The id is set to auto increment and is set as the primary.

Nothing has changed in the db but it just stopped working.

Sign in to reply to this post

Jason ByrnesWebAssist

please send a copy of the page.

Sign in to reply to this post

erinlima318673

Insert page returns error 'Duplicate entry '0' for key 'PRIMARY'' Reload this Page

see code for Insert page below:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Insert usedbikes</title>
<link href="WA_DataAssist/styles/Refined_Pacifica.css" rel="stylesheet" type="text/css" />
<link href="WA_DataAssist/styles/Arial.css" rel="stylesheet" type="text/css" />
</head>

<body>

<div class="WADAInsertContainer">
<form action="usedbikes_Insert.php" method="post" name="WADAInsertForm" id="WADAInsertForm">
<div class="WADAHeader">GP Motorcycles Major Unit Inventory: Insert Bike Details</div>

<div class="WADAHorizLine"><img src="WA_DataAssist/images/_tx_.gif" alt="" height="1" width="1" border="0" /></div>
<table class="WADADataTable" cellpadding="0" cellspacing="0" border="0">
<tr>
<th class="WADADataTableHeader">New or Used:</th>
<td class="WADADataTableCell"><table>
<tr>
<td width="72"><input type="radio" name="new_or_used" value="New" />
New</td>

</tr>
<tr>
<td><input type="radio" name="new_or_used" value="Used" />
Used</td>
</tr>
</table></td>
</tr>
<tr>

<th class="WADADataTableHeader">Model Year:</th>
<td class="WADADataTableCell"><input type="text" name="modelyear" id="modelyear" value="" size="32" /></td>
</tr>
<tr>
<th class="WADADataTableHeader">Make:</th>
<td class="WADADataTableCell"><input type="text" name="make" id="make" value="" size="32" /></td>
</tr>
<tr>

<th class="WADADataTableHeader">Model:</th>
<td class="WADADataTableCell"><input type="text" name="model" id="model" value="" size="32" /></td>
</tr>
<tr>
<th class="WADADataTableHeader">Description:</th>
<td class="WADADataTableCell"><input type="text" name="description" id="description" value="" size="32" /></td>
</tr>
<tr>

<th class="WADADataTableHeader">Mileage:</th>
<td class="WADADataTableCell"><input type="text" name="mileage" id="mileage" value="" size="32" /></td>
</tr>
<tr>
<th class="WADADataTableHeader">Stock Number:</th>
<td class="WADADataTableCell"><input type="text" name="stocknumber" id="stocknumber" value="" size="32" /></td>
</tr>
<tr>

<th class="WADADataTableHeader">Price:</th>
<td class="WADADataTableCell"><input type="text" name="price" id="price" value="" size="32" /></td>
</tr>
<tr>
<th class="WADADataTableHeader">Status:</th>
<td class="WADADataTableCell"><table>
<tr>
<td width="114"><input type="radio" name="status" value="In Inventory" />

In Inventory</td>
</tr>
<tr>
<td><input type="radio" name="status" value="Sold" />
Sold</td>
</tr>
</table></td>
</tr>

<tr>
<th class="WADADataTableHeader">Image Source URL:</th>
<td class="WADADataTableCell"><input type="text" name="image" id="image" value="" size="32" /></td>
</tr>
</table>
<div class="WADAHorizLine"><img src="WA_DataAssist/images/_tx_.gif" alt="" height="1" width="1" border="0" /></div>
<div class="WADAButtonRow">
<table class="WADADataNavButtons" border="0" cellpadding="0" cellspacing="0">

<tr>
<td class="WADADataNavButtonCell" nowrap="nowrap"><input type="image" name="Insert" id="Insert" value="Insert" alt="Insert" src="WA_DataAssist/images/Pacifica/Refined_insert.gif" /></td>
<td class="WADADataNavButtonCell" nowrap="nowrap"><a href="usedbikes_Results.php" title="Cancel"><img border="0" name="Cancel" id="Cancel" alt="Cancel" src="WA_DataAssist/images/Pacifica/Refined_cancel.gif" /></a></td>
</tr>
</table>
<input name="WADAInsertRecordID" type="hidden" id="WADAInsertRecordID" value="" />
</div>
</form>
</div>

</body>
</html>

Sign in to reply to this post

Jason ByrnesWebAssist

i need the full page, not just after the doctype, i need the code that does the insert to.

compress the php file into a zip archive and attach that with your replay.

Sign in to reply to this post

erinlima318673

Insert page returns error 'Duplicate entry '0' for key 'PRIMARY''

that makes more sense - see zipped file attached.

Attached Files
usedbikes_Insert.php.zip
Sign in to reply to this post

Jason ByrnesWebAssist

to help troubleshoot, change the following line of code:

php:
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());




to:

php:
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error()."<br />".var_dump($_POST)."");




this will write the sql top the screen causing the error to help us see whats going wrong.

Sign in to reply to this post

erinlima318673

Insert page returns error 'Duplicate entry '0' for key 'PRIMARY''

changed that line to the one you sent and rezipped the file. see attached.

Attached Files
usedbikes_Insert.php.zip
Sign in to reply to this post
loading

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