ok ... So here's what I'm trying to do. I am selling a site that I want people to be able to easily install the database and tables for it to use; here's what I have so far; but it's not working <?php require_once('../Connections/sitewidecms.php'); ?> <?php // Table structure for table `bannersdb` $sql = 'CREATE TABLE `sitewide`.`bannersdb` ( `banner_id` int(100) NOT NULL auto_increment, `banner_name` varchar(500) NOT NULL, `banner_href` varchar(500) NOT NULL, `banner_alt` varchar(200) default NULL, PRIMARY KEY (`banner_id`) ) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 AUTO_INCREMENT=0' ; echo 'Creating table: \'bannersdb\'....'; ?> PHP: I cut the code short, because basically If I can figure out how to use this script to create ONE table, I can use it to create the other tables as well; The 'required' file is a simple file that includes information on how to connect to the database. <?php # FileName="Connection_php_mysql.htm" # Type="MYSQL" # HTTP="true" $hostname_sitewidecms = "localhost"; $database_sitewidecms = "sitewidecms"; $username_sitewidecms = "username"; $password_sitewidecms = "password"; $sitewidecms = mysql_pconnect($hostname_sitewidecms, $username_sitewidecms, $password_sitewidecms) or trigger_error(mysql_error(),E_USER_ERROR); ?> PHP: So my question is, what am I missing to make this script work to install what I need; so that I can include a decent 'install' script to help people get up and running with ease. thanks
You have to add below: mysql_query($sql); your statement "$sql = '.....'" is just assigning the sql query text to a variable. It is ok, but you need to actually execute it afterwords with mysql_query command. good luck.
Ohh... I see - because right now, Nothing happens at all. That makes sense now; Forgive me I'm still a novice with php - still learning - I'll give this a try and see what happens. Thanks
I'm afraid that is out of the question! You will NEVER be forgiven. EVER! Just kidding, dude. No need to ask for forgiveness. I suppose you're just being polite.
You'll need this as well to connect to the DB. I didn't see it in your code and you've probably worked this out already but here goes... $db_selected = mysql_select_db($database_sitewidecms,$sitewidecms); PHP: And in a way we are all still Novices at this stuff. The Major thing is - you are giving it a go and asking questions. Keep at it! Cheers Tim