PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 25th, 2005, 06:33 AM
Hacktor Hacktor is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 1 Hacktor User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy Also a Parse error - help needed plz

This script I use to update my MySQL database. I'm using PHP 4.3.10.
I'm getting the following error:
Parse error: parse error in C:\Apache\Apache2\htdocs\bpm_db_install.php on line 56

Bold markerket in the script......

Script:
================================================== ==========
<?php
/************************************************** *************************
* bpm_db_install.php
* ----------------------
*
* copyright : ©2003, 2004 Duvelske (duvelske@planet.nl)
*
************************************************** *************************/
/************************************************** *************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
************************************************** *************************/
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
define('WPM_INST', $table_prefix.'wpm');
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//

if( !$userdata['session_logged_in'] )
{
$header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
header($header_location . append_sid("login.$phpEx?redirect=db_update.$phpEx", true));
exit;
}
if( $userdata['user_level'] != ADMIN )
{
message_die(GENERAL_MESSAGE, 'You are not authorised to view this page');
}

$page_title = 'Updating the database for the bpm mod v 1.0.3b';
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
echo '<table width="100%" cellspacing="1" cellpadding="2" border="0" class="forumline">';
echo '<tr><th>Updating the database for the bpm mod</th></tr><tr><td><span class="genmed"><ul type="circle">';

$sql = array();
$sql[] = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ("birthday_bpm", "0")";
$sql[] = "ALTER TABLE " . USERS_TABLE . " ADD user_birthday INT DEFAULT "999999" not null";
$sql[] = "ALTER TABLE " . USERS_TABLE . " ADD user_next_birthday_greeting INT DEFAULT "0" not null";
$sql[] = "CREATE TABLE " . WPM_INST . " (name varchar(255) NOT NULL default '', value text NOT NULL) TYPE=MyISAM";
$sql[] = "INSERT INTO " . WPM_INST . " VALUES ('bpm_version', '1.0.3b')";
$sql[] = "INSERT INTO " . WPM_INST . " VALUES ('active_bpm', '1')";
$sql[] = "INSERT INTO " . WPM_INST . " VALUES ('active_bpmmail', '0')";
$sql[] = "INSERT INTO " . WPM_INST . " VALUES ('bpm_username', 'Anonymous')";
$sql[] = "INSERT INTO " . WPM_INST . " VALUES ('bpm_userid', '-1')";
$sql[] = "INSERT INTO " . WPM_INST . " VALUES ('bpm_subject', 'Happy birthday')";
INSERT INTO phpbb_wpm VALUES ('bpm_message', 'Happy birthday [username]! You are now [age] years old :lol: If you have any questions about the site, please ask. If it goes about this mod please visit: http://www.vitrax.vze.com thnx you!');
for( $i = 0; $i < count($sql); $i++ )
{
if( !$result = $db->sql_query ($sql[$i]) )
{
$error = $db->sql_error();
echo '<li>' . $sql[$i] . '<br /> +++ <font color="#FF0000"><b>Error:</b></font> ' . $error['message'] . '</li><br />';
}
else
{
echo '<li>' . $sql[$i] . '<br /> +++ <font color="#00AA00"><b>Successfull</b></font></li><br />';
}
}

echo '</ul></span></td></tr><tr><td class="catBottom" height="28">&nbsp;</td></tr>';
echo '<tr><th>End</th></tr><tr><td><span class="genmed">Instalation is ready. Delete the file now!<br />If you have encounterd some errors, please visit <a href="http://www.vitrax.vze.com" target="_top">Vitrax support forums</a> and ask someone for help.</span></td></tr>';
echo '<tr><td class="catBottom" height="28" align="center"><span class="genmed"><a href="' . append_sid("index.$phpEx") . '">Have a nice day</a></span></td></table>';
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>

Reply With Quote
  #2  
Old January 25th, 2005, 10:59 AM
Madpawn Madpawn is offline
My beat is correct.
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 339 Madpawn User rank is Private First Class (20 - 50 Reputation Level)Madpawn User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 22 h 3 m 33 sec
Reputation Power: 4
Looks like you're missing a $sql[]= here:

PHP Code:
 $sql[] = "INSERT INTO " WPM_INST " VALUES ('bpm_subject', 'Happy birthday')"//semicolon ends this line, need to properly open next
 
INSERT INTO phpbb_wpm VALUES ('bpm_message''Happy birthday [username]! You are now [age] years old :lol: If you have any questions about the site, please ask. If it goes about this mod please visit: http://www.vitrax.vze.com thnx you!'); 


Also, please use php tags on your code in the future (with the small php icon in the upper right of the window). Makes it much more readable.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > Also a Parse error - help needed plz


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT