Note: Check out Tutorial CMS (www.tutcms.com) for updates on the new script!
3) Now to create our friendly installer script. Create a file called install.php and CHMOD it to 777. Insert the following coding inside:
CODE
<title>Installer</title>
<?php
//Getting the file db.php which includes our database settings.
define( 'DB_PATH' , "./" );
require DB_PATH."db.php";
//Installing
mysql_query("
CREATE TABLE `$mysql_table` (
`id` tinyint(11) NOT NULL auto_increment,
`title` text NOT NULL,
`avatar` text NOT NULL,
`date` varchar(50) NOT NULL,
`category` varchar(25) NOT NULL default '',
`description` text NOT NULL,
`author` text NOT NULL,
`email` text NOT NULL,
`content` text NOT NULL,
`views` varchar( 30 ) NOT NULL default '0',
PRIMARY KEY (`ID`)
) TYPE=MyISAM;
")
or die('Error, something is wrong.
Please make sure all information is correct and try again.');
echo "Install Complete! All the tables have been installed, and you are all set! This file has been deleted for security purposes. If not, please delete it manually.";
//Deleting the install.php file
unlink('install.php');
?>
What that does, is include the
db.php settings and runs the query into the database. If you dont want to use the installer, feel free to run the query below in your favorite mysql manager such as phpmyadmin
CODE
CREATE TABLE `tutorials` (
`id` tinyint(11) NOT NULL auto_increment,
`title` text NOT NULL,
`avatar` text NOT NULL,
`date` varchar(50) NOT NULL,
`category` varchar(25) NOT NULL default '',
`description` text NOT NULL,
`author` text NOT NULL,
`email` text NOT NULL,
`content` text NOT NULL,
`views` varchar( 30 ) NOT NULL default '0',
PRIMARY KEY (`ID`)
) TYPE=MyISAM;