Jump to content

Primary key?


eduard

Recommended Posts

Also, for phpMyAdmin specifically:http://wiki.phpmyadmin.net/pma/primary_keyhttp://www.google.com/search?client=opera&...channel=suggestInside phpMyAdmin, if you're looking at the fields in a table, there is a button next to the field to make it the primary key for the table. It's the icon with the little key in it.

Link to comment
Share on other sites

Also, for phpMyAdmin specifically:http://wiki.phpmyadmin.net/pma/primary_keyhttp://www.google.com/search?client=opera&...channel=suggestInside phpMyAdmin, if you're looking at the fields in a table, there is a button next to the field to make it the primary key for the table. It's the icon with the little key in it.
That´s what I don´t understand!Do I have to set the primary key in phpMyAdmin, in my php code or in both?
Link to comment
Share on other sites

You only need to set it in one place. You can set it in phpMyAdmin, you can build a query in PHP and send it to MySQL, you can use the MySQL command line tool, etc. Pick the one that sounds like the most fun.

Link to comment
Share on other sites

I changed in phpMyAdmin serialno into primay key! Now I get this message?Duplicate entry '0' for key 1

Link to comment
Share on other sites

So, what does that error tell you? I've already explained what a primary key means, so what is the problem that would cause that error?
A good question! If I knew the answer .....?
Link to comment
Share on other sites

A good question! If I knew the answer .....?
well, look at the error and read it... read it a few times...
duplicate entry '0' for key 1
do you have two records with the same value for that field? What about primary key's would tell you that is wrong, and thus causing the error?
Link to comment
Share on other sites

well, look at the error and read it... read it a few times...do you have two records with the same value for that field? What about primary key's would tell you that is wrong, and thus causing the error?
For you it´s a piece of cake because you´ve done it many times, but please try to imagine that´s very difficult for someone (like me!) who is doing this for the first time! (the error I don´t understand a f.... of it!)
Link to comment
Share on other sites

i guess if you don't know what the word duplicate means....I told you what to look for even. Did you even bother looking, or are you going to just start with the excuses again?edit: if you still don't get it, you never will. The point is to try and get you to figure these things out for yourself. We will give you the answer in time, but you need to put some basic effort into trying to find the answer for yourself first.

Link to comment
Share on other sites

So the database is telling you that you have a duplicate entry for a key, and you have no idea what the problem is? Look up the information we've given you in primary keys again, read about what a primary key is, and see if you can figure out what the database is telling you. You need to be able to read error messages and use them to research the problem and figure out the cause. Other programmers don't debug their programs by asking people, they do their own research. This particular error is very easy to solve, you just need to put some effort into it.

Link to comment
Share on other sites

Let me explain the frustration, Eduard. You said you were trying to make an effort to learn, so let me point out why we get frustrated with you.I told you here and here that primary keys need to be unique, they do not allow duplicates. Ingolme also pointed you to the tutorial on creating tables, which says this:

A primary key is used to uniquely identify the rows in a table. Each primary key value must be unique within the table.
I also pointed you to the phpMyAdmin wiki, which says this:
A primary key is an index over one or more fields in a table with unique values for each single row in this table.
So, there are at least 4 sources that are telling you that primary keys need to be unique, they cannot contain duplicates. Then you get an error message that says you have a duplicate key, and you have NO IDEA what could POSSIBLY be the problem. So apparently you're not reading what we're saying, or what we're giving you to read.But that's fine, who cares, whatever, maybe you don't like to read. The other problem is that you're not willing to do your own research. Look what you get if you type your error message into Google:http://www.google.com/search?client=opera&...channel=suggestAny number of pages where you can learn that a primary key needs to be unique.So, we've told you the answers several times, we've linked you to documentation and tutorials that have the answers on it, and you still have no clue what the problem is, and you're not willing to research the problem yourself to look for answers.That is why we get frustrated with you.
Link to comment
Share on other sites

So the database is telling you that you have a duplicate entry for a key, and you have no idea what the problem is? Look up the information we've given you in primary keys again, read about what a primary key is, and see if you can figure out what the database is telling you. You need to be able to read error messages and use them to research the problem and figure out the cause. Other programmers don't debug their programs by asking people, they do their own research. This particular error is very easy to solve, you just need to put some effort into it.
Thanks! That´s a reply that really helps me!
Link to comment
Share on other sites

Let me explain the frustration, Eduard. You said you were trying to make an effort to learn, so let me point out why we get frustrated with you.I told you here and here that primary keys need to be unique, they do not allow duplicates. Ingolme also pointed you to the tutorial on creating tables, which says this:I also pointed you to the phpMyAdmin wiki, which says this:So, there are at least 4 sources that are telling you that primary keys need to be unique, they cannot contain duplicates. Then you get an error message that says you have a duplicate key, and you have NO IDEA what could POSSIBLY be the problem. So apparently you're not reading what we're saying, or what we're giving you to read.But that's fine, who cares, whatever, maybe you don't like to read. The other problem is that you're not willing to do your own research. Look what you get if you type your error message into Google:http://www.google.com/search?client=opera&...channel=suggestAny number of pages where you can learn that a primary key needs to be unique.So, we've told you the answers several times, we've linked you to documentation and tutorials that have the answers on it, and you still have no clue what the problem is, and you're not willing to research the problem yourself to look for answers.That is why we get frustrated with you.
You know (as I wrote before!) reading (when you are very stressed and get a lot information! You can´t imagine how it is moving to another country (Chile) of another continent (south-america), another language (spanish) as a disabled person!) is not the solution; a simple, clear example it is: http://www.tizag.com/mysqlTutorial/mysqltables.phpSo, neither in the tutorial nor a person have send me a diagram as shown on the web page above!
Link to comment
Share on other sites

The W3Schools has a diagram of a database table just like that one:http://w3schools.com/php/php_mysql_intro.asphttp://w3schools.com/sql/sql_syntax.aspThe diagram you've shown doesn't graphically explain a primary key.And along with those pages, this one will teach you about primary keys:http://w3schools.com/php/php_mysql_create.asp

Link to comment
Share on other sites

The W3Schools has a diagram of a database table just like that one:http://w3schools.com/php/php_mysql_intro.asphttp://w3schools.com/sql/sql_syntax.aspThe diagram you've shown doesn't graphically explain a primary key.And along with those pages, this one will teach you about primary keys:http://w3schools.com/php/php_mysql_create.asp
This isn´t a diagram I needed! (what´s a column?, what´s a row?, what´s an index?, etc.?)Primary key is explained below the diagram!P. s. the url you wrote I read, however the same problem: only text, no example!
Link to comment
Share on other sites

This isn´t a diagram I needed! (what´s a column?, what´s a row?, what´s an index?, etc.?)
we've already been through this with you before...I never really understand what it is you want from us. We give you the answers and explanations but nothing ever seems to stick.
Link to comment
Share on other sites

i guess if you don't know what the word duplicate means....I told you what to look for even. Did you even bother looking, or are you going to just start with the excuses again?edit: if you still don't get it, you never will. The point is to try and get you to figure these things out for yourself. We will give you the answer in time, but you need to put some basic effort into trying to find the answer for yourself first.
DUPLICATE? I´m not that stupid!
Link to comment
Share on other sites

we've already been through this with you before...I never really understand what it is you want from us. We give you the answers and explanations but nothing ever seems to stick.
That´s why I get a book! Saves me (and you!) a lot of frustration!
Link to comment
Share on other sites

I think "column" and "row" are defined in the dictionary, that's why most people believe it needs no further explanation.
All words are in dictonaries! But to show the meaning of them not (maybe in wikipedia!)
Link to comment
Share on other sites

DUPLICATE? I´m not that stupid!
so what's the problem then? If you know (have been told) what to look for, and you understand what a primary key is, and you have books explaining things for you, you've had us explain table/row/columns/fields/records and all that to you in the past, and if you read my and anyone else's posts, you should have figured out that two (or more) records have the same value when you were trying to set one of their fields to be the primary key. I'm not sure what more you need from us. It seems pretty obvious by now I would hope.
Link to comment
Share on other sites

alrighty, let's all calm down a bit.Eduard is NEW to programming with NO prior experience or even basic knowledge.The admins here assume users have some basic knowledge, otherwise it's not the right place for Eduard.@Eduard, i mentioned in a post a few weeks ago about this place being the BEST. SCHOOL. EVER. - bear in mind, ALL schools have a minimum requirement of entrance.eg. they wouldn't even think of letting a kid enter grade school if they couldn't even read the alphabet.remember i mentioned the W3Schools tutorials mention what you need to know first ?please read those requirements again and don't think, "i can skip that and just guess my way for more difficult things".things like "rows, columns" are really very basic terminology in database handling and if you're not yet familiar with these you need to read the "dB basic book 101" from cover to cover first.don't try to run if your walking is still not perfect.even i myself have not yet started using SQL and just learning PHP with simple text files.if you want to learn more about SQL basics, there's a whole section on this forum for that - you would get more focussed responses, and even other students can reply to you since they will probably understand what you're trying to do.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...