is_published tinyint(1) NOT NULL default 0 , date_submitted datetime (Photography web hosting)

is_published tinyint(1) NOT NULL default 0 , date_submitted datetime NOT NULL default 0000-00-00 00:00:00 , date_published datetime NOT NULL default 0000-00-00 00:00:00 , title varchar(255) NOT NULL default , body mediumtext NOT NULL, PRIMARY KEY (article_id), KEY IdxArticle (author_id,date_submitted), FULLTEXT KEY IdxText (title,body) ) EOS; $result = mysql_query($sql) or die(mysql_error()); The PRIMARY KEY, you may remember from Chapter 10, is what ensures that each row is unique because it is the unique identifier for each row in the table. The keyword KEY is similar to PRIMARY KEY, and in fact can be substituted for PRIMARY KEY in most cases. In this particular case, KEY is used as a synonym for INDEX, which allows subsequent SQL statements to find data very quickly. Because you will be looking for articles by author and by date, those are the fields used to create the index. For more information on how MySQL uses indexes, visit dev.mysql.com/doc/mysql/en/MySQL_indexes.html. You also allow users of the CMS application to search for articles based on text entered in a search string. To perform such a search (which you allow for the title and body fields), you use the FULLTEXT KEY keyword when creating your table. This is identical to using FULLTEXT INDEX. When creating the cms_users table, you use the previous keywords to create both PRIMARY KEY to uniquely identify table rows, and UNIQUE KEY to ensure that each user s e-mail address is unique. PRIMARY KEY (user_id), UNIQUE KEY uniq_email (email) After creating the cms_users table, you insert one record so that the administrator is able to log in with Admin permissions. This allows you to immediately administer the site as needed. This data is echoed to the screen to provide you with some feedback that everything has worked as you expected. $sql = INSERT IGNORE INTO cms_users . VALUES (NULL, $adminemail , $adminpass , $adminname , 3) ; $result = mysql_query($sql) or die(mysql_error()); echo ; echo CMS Tables created. Here is your initial login information:n ; echo

  • login: . $adminemail .
  • n ; echo

  • password: . $adminpass .

n ; echo Login to the site now. ; 421 Building a Content Management System
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check mysql web server services.