Wrox Programmer Forums
|
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6
This is the forum to discuss the Wrox book Beginning PHP, Apache, MySQLWeb Development by Michael K. Glass, Yann Le Scouarnec, Elizabeth Naramore, Gary Mailer, Jeremy Stolz, Jason Gerner; ISBN: 9780764557446
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 15th, 2004, 11:42 PM
Authorized User
 
Join Date: Jun 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default MYISAM or InnoDB?

Hello,
I found in the book that in some php-sql files (when creating tables) there are different types as MyISAM or InnoDB or nothing specified. Could you please tell me when I should use which type? What is default value?

Example from p.362
CREATE TABLE IF NOT EXISTS cms_access_levels (
access_lvl tinyint(4) NOT NULL auto_increment,
access_name varchar(50) NOT NULL default ‘’,
PRIMARY KEY (access_lvl)
)

Example from p.129
$reviews = “CREATE TABLE reviews (
review_movie_id int(11) NOT NULL,
review_date date NOT NULL,
review_name varchar(255) NOT NULL,
review_reviewer_name varchar(255) NOT NULL,
review_comment varchar(255) NOT NULL,
review_rating int(11) NOT NULL default 0,
KEY (review_movie_id),
) TYPE=MyISAM”;

and also, I saw somewhere else it can be written as InnoDB:
CREATE TABLE IF NOT EXISTS a_levels (
access_lvl tinyint(4) NOT NULL auto_increment,
access_name varchar(50) NOT NULL default ‘’,
PRIMARY KEY (access_lvl)
)type = InnoDB;
 
Old June 16th, 2004, 08:34 AM
Authorized User
 
Join Date: Jun 2004
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I might be wrong, but I don't remember anything in the book that specifically required the InnoDB table type (only major difference is transaction capability, which is not covered in the book), so you can probably just use MyISAM or leave that part off (default table type is MyISAM, if I remember correctly).

 
Old July 19th, 2004, 11:51 PM
Authorized User
 
Join Date: Jun 2004
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If I remember correctly, the InnoDB engine supports relational databases by enforcing referential integrity. In other words, if you try to delete a record on a parent table which has corresponding records on a child table, the engine will generate a mysql error(?).

MyISAM is the default engine and is probably OK for many simple applications such as the ones illustrated in the book. But if you need a relational database, and especially if you are creating a very large database, you must use InnoDB.

From the MySQL Manual: "From MySQL 4.0 on, the InnoDB storage engine is enabled by default." See http://dev.mysql.com/doc/mysql/en/InnoDB.html for documentation.

 
Old July 20th, 2004, 09:40 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The only reference to InoDB on the book was when an example was given on how to create the different kind of tables Mysql supports, but the book doesn't really uses any other kind of tables beside MyISAM

Christian






Similar Threads
Thread Thread Starter Forum Replies Last Post
Chp 3 96-98 syntax error: ') TYPE=MYISAM saross BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 7 January 29th, 2006 05:28 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.