I'm trying execute a bunch of mysql statements in one php document I just can't figure it out, instead it can only execute one.
<?php
define('IN_PHPBB', TRUE);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'config.' . $phpEx);
include($phpbb_root_path . 'includes/db.' . $phpEx);
$db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, FALSE);
if ( !$db->db_connect_id )
{
die('A database connection could not be established.');
}
$sql['mysql'] = 'MYSQL STATEMENTS HERE';
if ( !isset($sql[$dbms]) )
{
die('There is no database support for ' . ucfirst($dbms) . '.<br />Here is the MySQL code, if you can convert.<br /><pre>' . $sql['mysql'] . '</pre>');
}
if ( !$db->sql_query(str_replace('phpbb_', $table_prefix, $sql[$dbms])) )
{
$error = $db->sql_error();
die('An error occured while querying the database.<br /><b>Error Message:</b>' . $error['message'] . '<br /><b>Error Code:</b>' . $error['code']);
}
echo 'BBCodes table created successfully.<br />You should delete this file ( ' . $HTTP_SERVER_VARS['PHP_SELF'] . ' ).';
?>
CREATE TABLE bbcodes (
bbcode_id int(10) unsigned NOT NULL auto_increment,
bbcode_params varchar(255) NOT NULL default '',
bbcode_code varchar(255) NOT NULL default '',
bbcode_replace varchar(255) NOT NULL default '',
bbcode_example varchar(255) NOT NULL default '',
PRIMARY KEY (bbcode_id)
) TYPE=MyISAM;
INSERT INTO bbcodes VALUES (1, '', 'date', '<table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"><tr><td><span class="genmed"><b>Date:</b></span></td></tr><tr><td class="code">\\1</td></tr></table>', 'Date');
INSERT INTO bbcodes VALUES (2, '', 'timein', '<table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"><tr><td><span class="genmed"><b>Time In:</b></span></td></tr><tr><td class="code">\\1</td></tr></table>', 'Time In');
INSERT INTO bbcodes VALUES (3, '', 'timeout', '<table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"><tr><td><span class="genmed"><b>Time Out:</b></span></td></tr><tr><td class="code">\\1</td></tr></table>', 'Time Out');
INSERT INTO bbcodes VALUES (4, '', 'log', '<table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"><tr><td><span class="genmed"><b>Daily Activities:</b></span></td></tr><tr><td class="quote">\\1</td></tr></table>', 'Daily Activities');
INSERT INTO bbcodes VALUES (5, '', 'hours', '<table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"><tr><td><span class="genmed"><b>Todays Hours:</b></span></td></tr><tr><td class="code">\\1</td></tr></table>', 'Todays Hours');
INSERT INTO bbcodes VALUES (6, '', 'timetotal', '<table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"><tr><td><span class="genmed"><b>Total Time Accumulated:</b></span></td></tr><tr><td class="code">\\1</td></tr></table>', 'Total Time Accumulated');
INSERT INTO bbcodes VALUES (7, '', 'newtotal', '<table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"><tr><td><span class="genmed"><b>New Grand Total Of Time:</b></span></td></tr><tr><td class="code">\\1</td></tr></table>', 'New Grand Total Of Time');
INSERT INTO bbcodes VALUES (8, '', 'com', '<table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"><tr><td><span class="genmed"><b>End Of Week Comments:</b></span></td></tr><tr><td class="quote">\\1</td></tr></table>', 'End Of Week Comments');
ALTER TABLE users ADD user_parents VARCHAR(255);
ALTER TABLE users ADD user_parentem VARCHAR(255);
ALTER TABLE users ADD user_parentwn VARCHAR(255);
ALTER TABLE users ADD user_parentcn VARCHAR(255);
ALTER TABLE users ADD user_parentpn VARCHAR(255);
Thanks for any help!
-Phil