install script
Moderator: General Moderators
- shiznatix
- DevNet Master
- Posts: 2745
- Joined: Tue Dec 28, 2004 5:57 pm
- Location: Tallinn, Estonia
- Contact:
install script
i wanna write a script that automatically creates a database, creates the tables, and creates the fields. i have all the sql laid. how do i do this?
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Code: Select all
$sql = "CREATE ..... all your sql goes here";
mysql_connect('localhost','user','pass')
mysql_query($sql) or die(mysql_error());I also recommend you have either as install.php or /install/
and then check to make sure the install file/folder is gone when your site goes live
so in index.php
Code: Select all
if (is_file('install.php'))
exit('Please delete install.php');also might want to chck
http://dev.mysql.com/doc/mysql/en/index.html
- shiznatix
- DevNet Master
- Posts: 2745
- Joined: Tue Dec 28, 2004 5:57 pm
- Location: Tallinn, Estonia
- Contact:
the database hasnt been created yet...thats what im trying to do
is giving me that error
Code: Select all
$sql = "CREATE DATABASE `forum`;";
mysql_connect('localhost', $dbusername, $dbpassword);
mysql_query($sql) or die(mysql_error());