Solved

primary key confusion

Posted on 2013-06-27
3
284 Views
Last Modified: 2013-06-28
Hi,

In phpmyadmin I cant alter tables to get the primary key.  I want to set a primary key with autonumber and I know I check on a-I on creating a field .

If you see the img I have a field with PK that I cant undo the PK and I cant add a autonumber field as a PK as I get an error (need a PK)
mysql.docx
0
Comment
Question by:jagguy
3 Comments
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 39281685
Consider recreating the table.  You might write a little script to copy the data to the new table.
0
 
LVL 54

Accepted Solution

by:
Julian Hansen earned 500 total points
ID: 39281748
You shouldn't have to recreate the table.

What do you see when you edit (Change) the record - your version of PHPMyAdmin differs from the versions I am using

Have you tried running a query to do this
ALTER TABLE tbmod1 
   CHANGE `section` `section` INT(11) NOT NULL, 
   CHANGE `q1` `q1` INT(11) NOT NULL AUTO_INCREMENT,
   DROP PRIMARY KEY, 
   ADD PRIMARY KEY(`q1`)

Open in new window

Remember though before you can make a column a auto increment the column has to have unique values otherwise it will fail.
Also check if there are any relationships setup on the table which might be interferring.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39283611
Please use image files like JPGs for screen shots.  They will open in the browsers where 'docx' files require us to start up another program.  I usually won't do that and I haven't looked at your file.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question