-
Question About Column
I am going to import about 200 generated codes into a MySQL table... Just had a queation, the codes will look like this as an e.g. 7dYhsj8. So would I just make then 'Text' as the data type and Not Null?
-
-
Don't use TEXT, use VARCHAR(7) or bigger, to the maximum possible size of the code.
-
-
Twey are you familiar at all with phpMyAdmin? Attached is a snap shot of my table columns... It has alot of other options which I am not sure about... I made the id the primary key, do i need to make the code column a unique key?
-
-
Somewhat, but not very. I prefer the command-line client.
If the code is going to be unique, you might as well use that as the primary key and scrap the ID column.
-
-
ID columns often confuse me though, because if I delete a record, it will skip the ID. Example 1, 2, 3, (deleted), 5, 6, 7.
So if I use a loop that method of obtaining the data won't work. Instead I use mysql_fetch_assoc().
As for the data type, I wouldn't use TEXT if it's only about 10 characters long, as Twey stated varchar would be better.
- Mike
-
-
mysql_fetch_row() and mysql_fetch_assoc() are now both redundant... you should use mysql_fetch_array() instead (a second argument can be passed, MYSQL_NUM to return a purely numerical array or MYSQL_ASSOC to return a solely associative array).
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks