Page 1 of 1
Need help with unique table
Posted: Sun Dec 29, 2013 11:55 am
by tarnos12
Hey, I have a problem with unique table or columns, I cant edit/delete anything I add to this table:
"The table does not contain a unique column. Functions related to the editing grid, checkbox, edit, copy and delete links may not work."
I managed to do something when I add new column with name that is not yet used in any other table, but I need more info about this if anyone can help.
I noticed that name alone doesnt change anything, so I need to do something else, i read about primary keys but even If I want to add one I need a column which name is not duplicated anywhere in my db, so I just need to create a random column and make it as primary key, even if I wont use it

I have no idea what to do.
I uploaded database so you can check it out. Thanks in advance.
Re: Need help with unique table
Posted: Sun Dec 29, 2013 4:25 pm
by alexander19
Try adding an ID column, make it INT and select the auto increment option(A_I).
Re: Need help with unique table
Posted: Sun Dec 29, 2013 4:40 pm
by tarnos12
so in other words I am forced to create new column for each table.
Re: Need help with unique table
Posted: Sun Dec 29, 2013 5:31 pm
by hallsofvallhalla
I am not sure what you are trying to accomplish here. What do you mean by "I need a column which name is not duplicated anywhere in my db"
Re: Need help with unique table
Posted: Sun Dec 29, 2013 5:36 pm
by tarnos12
check out my db i posted before.
"The table does not contain a unique column. Functions related to the editing grid, checkbox, edit, copy and delete links may not work."
I am not sure what to do about it, I figured out that I need some kind of primary index since I cannot edit/delete anything from store/inventory since this message pops out. I added some index but I dont know how it really works so thats why I uploaded my database so u can see whats wrong with it.
Lets say i have table called store/inventory. I cant edit anything once I add an item to the store because this table does not contain a unique column. I need to add new column probably and set it as a primary column, because when I try to set name/id or anything else as primary key it shows me an error that say its duplicated or something like that. When I create a new column called whatever I want(which is not used in any other table) I can set it as primary key and it works.
by column i mean id/name/price/gold/exper etc. not sure how to call it
Re: Need help with unique table
Posted: Sun Dec 29, 2013 8:55 pm
by hallsofvallhalla
did you already set a primary key on another column in the DB? I cannot check it as I am not on a PC with SQL atm.
Re: Need help with unique table
Posted: Sun Dec 29, 2013 9:14 pm
by tarnos12
I think I did, but as I said I dont know how to use those primary keys, does it matter which column i set as primary key?
"Each table in a database should have a primary key field.
A primary key is used to uniquely identify the rows in a table. Each primary key value must be unique within the table. "
Thats what I found out, in your videos you use old phpmyadmin db or something thats why I had a problem with it. I have to create a new field called whatever I want as a primary key for each table/column. I also read that I have to set is as AUTO_INCREMENT and NOT NULL setting to this field I set as primary. is that how its supossed to work? Does that mean I can simply change name/id into auto_increment and not null so it will work? and can I still use it with my code? or should i simply create a random field and set it as primary key?
and second question, if I want to start my own game for learing as well as I want to keep following your tutorial, how do I create a database which will contain same stuff like characters/names/id/store/inv/stats? wont they prevent each other from working? or is that not possible? and if I create a new project I simply use same db for it with different tables? like players2/store2/name2/attack2. I am at around 11 episode, when I was at 7-8 I was able to add gold using info u provided as well I made it to drop from monsters on dead using same math you used for experience since I dont know how to do it other way. I had problem with buying stuff for gold, because I updated store.php instead of that other file. well anyway I hope u can help me so I could try something on my own, w/o deleting db I created following your videos. Thanks
@edit:
I am so dumb
Code: Select all
if(!mysql_select_db("tutorial",$db))
I can start creating something on my own with help of your tutorial, but still I need help with first problem, I might solve it by myself (if I didnt solve it already)
btw I have read on forum u said something about updating your videos since they are old or something, any idea when you are going to begin it?