Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old June 15th, 2004, 11:42 PM
Authorized User
 
Join Date: Jun 2004
Location: , , .
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;
Reply With Quote
  #2 (permalink)  
Old June 16th, 2004, 08:34 AM
Authorized User
 
Join Date: Jun 2004
Location: , , .
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).

Reply With Quote
  #3 (permalink)  
Old July 19th, 2004, 11:51 PM
Authorized User
 
Join Date: Jun 2004
Location: , , .
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.

Reply With Quote
  #4 (permalink)  
Old July 20th, 2004, 09:40 AM
Friend of Wrox
 
Join Date: Jun 2004
Location: Fairfield, Iowa, USA.
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

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 04:28 PM



All times are GMT -4. The time now is 10:48 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.