Re: phpMyAdmin

From: Date: Fri, 03 May 2002 16:49:46 +0000
Subject: Re: phpMyAdmin
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-95925@lists.php.net to get a copy of this message
I've always found it's good to set numeric primary keys to UNSIGNED. Gives you a larger range, and it's not very likely those numbers are ever going to be negative. Also, there is absolutely no need to check Index or Unique when you have selected Primary, as Primary implies both (hence why in newer versions, Primary/Index/Unique are radio buttons). Lastly, unless you expect to have a rediculous amount of records, an INT is more that sufficient (giving you a maximum record count of 4,294,967,295). Also, PHP's mysql_insert_id() doesn't support BIGINT data types. So, the more optimised version of the keyfield would be:
Field: keynum Type: INT Length/Values: (blank) Attributes: UNSIGNED Null: NOT NULL Default: (blank) Extra: AUTO_INCREMENT Primary: SELECTED Index: UN-SELECTED Unique: UN-SELECTED
Mike Kevin Stone wrote:
Could be something like.. Field: keynum Type: BIGINT Length/Values: (blank) Attributes: (blank) Null: NOT NULL Default: (blank) Extra: AUTO_INCREMENT Primary: CHECKED Index: CHECKED Unique: CHECKED Field: username Type: VARCHAR Length/Values: 20 Attributes: (blank) Null: NOT NULL Default: (blank) Extra: (blank) Primary: UNCHECKED Index: UNCHECKED Unique: UNCHECKED Field: password Type: VARCHAR Length/Values: 20 Attributes: (blank) Null: NOT NULL Default: (blank) Extra: (blank) Primary: UNCHECKED Index: UNCHECKED Unique: UNCHECKED Note I prefer to use VARCHAR instead of PASSWORD becuase I am more comfortable checking the database contents in PHP rather than SQL. But you can do a PASSWORD field then in your query statment use the SQL funciton PASSWORD($pwd) to encrypt the string. Either way, for security, it is imparative that you encrypt it. The field 'keynum' is just a standard thing that I do. It's set up to auto_increment so you always have a unique key to delete and update records on. For more information view the SQL documentation on www.mysql.com. Hope this helps! -Kevin ----- Original Message ----- From: "Rodrigo" <tagzero@tagzero.com> To: <php-general@lists.php.net> Sent: Friday, May 03, 2002 10:18 AM Subject: [PHP] phpMyAdmin
Hi guys, I need some help using the phpMyAdmin, I'm trying to create a table with three fields, one for the indexing of the database, the second for the logins and the third for the password. I get the following doubts: On the table of the phpMyAdmin there are the following fields: A field for the name of the field. A field for the kind of information that will be stored in the field (TINYINT,DOUBLE,TEXT...) A field for the size of the field. A field for the atributes of the field (BINARY, UNSIGNED, UNSIGNED ZERO FILL) A field for the null option (NULL, NOT NULL). A field for an information that I don't know... A field for the Extra(AUTO_INCREMENT). A selectable field named primary(check it or not). A selectable field named index(check it or not). A selectable field named unique(check it or not). A selectable field named Fulltext(Check it or not). The information that I would need would be what are the configurations that I have to put in each of these fields. And also I would need to know a php script to access the fields, and write to new fields. Thanx, Rodrigo


« previous php.general (#95925) next »