Log in

View Full Version : phpmyadmin: Part of Row is flagged red



Kage Kazumi
10-22-2012, 03:57 AM
I created a table in phpmyadmin called "members" and it has a row called "name" which I have it set as such:

Name = name | Type = INT | Length/Values = 100 |

Now when I type in "admin" in the "name" section for inserting content the type box highlights red. I click save and it turns "admin" into "0."

Also phpmyadmin is also auto adding a Collation of "latin1_swedish_ci" to "varcar" how can I stop it from adding this or is this normal?

phpmyadmin Version: 3.5.3 (extended features not activated)

traq
10-22-2012, 04:13 AM
why are you trying to save string data into an INT field? :p

Yes, you can change the collation. Look in the [Operations] tab. You can change the DB's default charsets and collation, also.

I always specify them when creating the table, so this is never a problem:
CREATE TABLE IF NOT EXISTS `tablename`(
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT
--etc., etc..
,PRIMARY KEY(`id`)
) DEFAULT CHARSET=utf8;

# while setting the defaults for your whole DB is a good idea
# (and setting it to utf8 is an even better idea!),
# setting it explicitly when you create the tables makes your code more portable.

# you can specify a default collation also,
# however, mysql will automatically use the default collation for the specified charset,
# so it's not really necessary unless you want a particular, off-the-wall collation.

Kage Kazumi
10-22-2012, 04:46 AM
why are you trying to save string data into an INT field? :p


So a username field should be varchar? Also it was how I saw someone set up the database in their video.




Yes, you can change the collation. Look in the [Operations] tab.

Yes I know this. The issue is if I do not choose anything phpmyadmin is auto doing it and sometimes when I change it it changes back to what it was previously.

traq
10-22-2012, 06:01 AM
So a username field should be varchar?
probably the best choice in this case. VARCHAR fields have a maximum size of 255 characters.


...The issue is if I do not choose anything phpmyadmin is auto doing it and sometimes when I change it it changes back to what it was previously.it shouldn't be changing back on its own. are you sure your changes are being saved?

A thought: are you sure you're changing the correct setting? phpmyadmin has a very prominent collation option that applies to *the connection*, and is reset every session. Make sure you're changing the option for the database itself. The surest way is to use a query.
ALTER TABLE `myTable`
CHARSET utf8
COLLATE utf8_general_ci;

you can change the default charset/collation on a database-level basis:
ALTER DATABASE `myDatabase`
DEFAULT CHARSET utf8
DEFAULT COLLATE utf8_general_ci;