NYCPHP Meetup

NYPHP.org

[nycphp-talk] Learning to program the right way

Joseph Crawford codebowl at gmail.com
Mon Jan 23 18:03:35 EST 2012


Taken from Zend Framework A Beginners Guide which is the most up to date book about Zend Framework
which targets ZF 1.10

mysql> CREATE TABLE IF NOT EXISTS user (
-> RecordID INT(4) NOT NULL AUTO_INCREMENT, -> Username VARCHAR(10) NOT NULL,
-> Password TEXT NOT NULL,
-> PRIMARY KEY (RecordID)
-> ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Why would you ever use TEXT for a password field? Not to mention all the other types etc.

mysql> CREATE TABLE IF NOT EXISTS type (
-> TypeID INT(11) NOT NULL AUTO_INCREMENT, -> TypeName VARCHAR(255) NOT NULL,
-> PRIMARY KEY (TypeID)
-> ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

         Query OK, 0 rows affected (0.09 sec)

mysql> CREATE TABLE IF NOT EXISTS item (
-> RecordID INT(11) NOT NULL AUTO_INCREMENT, -> RecordDate DATE NOT NULL,
-> SellerName VARCHAR(255) NOT NULL,
-> SellerEmail VARCHAR(255) NOT NULL,
-> SellerTel VARCHAR(50) DEFAULT NULL,
-> SellerAddress TEXT,
-> Title VARCHAR(255) NOT NULL,
-> `Year` INT(4) NOT NULL,
-> CountryID INT(4) NOT NULL,
-> Denomination FLOAT NOT NULL,
-> TypeID INT(4) NOT NULL,
-> GradeID INT(4) NOT NULL,
-> SalePriceMin FLOAT NOT NULL,
-> SalePriceMax FLOAT NOT NULL,
-> Description TEXT NOT NULL,
-> DisplayStatus TINYINT(1) NOT NULL,
-> DisplayUntil DATE DEFAULT NULL,
-> PRIMARY KEY (RecordID)
-> ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

         Query OK, 0 rows affected (0.09 sec)

mysql> CREATE TABLE IF NOT EXISTS user (
-> RecordID INT(4) NOT NULL AUTO_INCREMENT, -> Username VARCHAR(10) NOT NULL,
-> Password TEXT NOT NULL,
-> PRIMARY KEY (RecordID)
-> ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Query OK, 0 rows affected (0.09 sec) mysql> CREATE TABLE IF NOT EXISTS log (

-> RecordID int(11) NOT NULL AUTO_INCREMENT, -> LogMessage text NOT NULL,
-> LogLevel varchar(30) NOT NULL,
-> LogTime varchar(30) NOT NULL,

-> Stack text,
-> Request text,
-> PRIMARY KEY (RecordID)
-> ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

 

On Jan 23, 2012, at 5:25 PM, Greg Rundlett (freephile) wrote:

> 
> I'm curious if there are any other items people think should be incorporated into this tutorial.
> 
> I think that there have been books like this (For example, a book from 2004 written by George Schlosshnagle:  http://www.amazon.com/Advanced-PHP-Programming-George-Schlossnagle/dp/0672325616) and I agree that there should be more books or tutorials that combine the language particulars with the complete set of best practices that make up software development.
> 
> 
> Greg Rundlett
> my public PGP key
> _______________________________________________
> New York PHP User Group Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
> 
> http://www.nyphp.org/show-participation




More information about the talk mailing list