Искам едни дата бази да ми се напправят в php и....

  • Автор Автор dan4o
  • Начална дата Начална дата

dan4o

Registered
Искам едни дата бази да ми се напправят в php и като отворя тоя файл да ми зареди заявките към MySql и да ги изпълни
Това са от модове за phpbb
Nomer 1
Код:
  CREATE TABLE `phpbb_inline_ads` (
`ad_id` TINYINT( 5 ) NOT NULL auto_increment,
`ad_code` TEXT NOT NULL ,
`ad_name` CHAR( 25 ) NOT NULL,
PRIMARY KEY (`ad_id`)
);

INSERT INTO `phpbb_inline_ads` (`ad_id` , `ad_code`, `ad_name` )
VALUES
('1', 'Your banner code goes here', 'Default');

INSERT INTO `phpbb_config` ( `config_name` , `config_value` )
VALUES
('ad_after_post', '1'),
('ad_post_threshold', ''),
('ad_every_post', ''),
('ad_who', '1'),
('ad_no_forums', ''),
('ad_no_groups', ''),
('ad_old_style', '1');

Nomer 2
Код:
# 
#-----[ SQL ]------------------------------------------
#
#   If you don't know how to execute sql queries, then copy
#   sql_install.php into your phpbb directory and run it.
#   (assuming you use mysql or mssql)
#
#   If you don't use mysql or mssql, you'll have to edit these queries accordingly
# 
#   If you have a different table prefix then change this command accordingly. 
#   I have used the default table prefix! 
# 
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_disable',0);
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_display_after_posts',1);
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_post_message','You earned %s for that post');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_disable_spam_num',10);
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_disable_spam_time',24);
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_disable_spam_message','You have exceeded the alloted amount of posts and will not earn anything for your post');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_installed','yes');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_version','2.2.3');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_adminbig','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_adminnavbar','1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('points_name','Points');

# 
#-----[ SQL ]------------------------------------------ 
# 
#   If you have a different table prefix then change this command accordingly. 
#   I have used the default table prefix! 
# 
CREATE TABLE phpbb_cash (
  cash_id smallint(6) NOT NULL auto_increment,
  cash_order smallint(6) NOT NULL default '0',
  cash_settings smallint(4) NOT NULL default '3313',
  cash_dbfield varchar(64) NOT NULL default '',
  cash_name varchar(64) NOT NULL default 'GP',
  cash_default int(11) NOT NULL default '0',
  cash_decimals tinyint(2) NOT NULL default '0',
  cash_imageurl varchar(255) NOT NULL default '',
  cash_exchange int(11) NOT NULL default '1',
  cash_perpost int(11) NOT NULL default '25',
  cash_postbonus int(11) NOT NULL default '2',
  cash_perreply int(11) NOT NULL default '25',
  cash_maxearn int(11) NOT NULL default '75',
  cash_perpm int(11) NOT NULL default '0',
  cash_perchar int(11) NOT NULL default '20',
  cash_allowance tinyint(1) NOT NULL default '0',
  cash_allowanceamount int(11) NOT NULL default '0',
  cash_allowancetime tinyint(2) NOT NULL default '2',
  cash_allowancenext int(11) NOT NULL default '0',
  cash_forumlist varchar(255) NOT NULL default '',
  PRIMARY KEY  (cash_id)
);

# 
#-----[ SQL ]------------------------------------------ 
# 
#   If you have a different table prefix then change this command accordingly. 
#   I have used the default table prefix! 
# 
CREATE TABLE phpbb_cash_events (
  event_name varchar(32) NOT NULL default '',
  event_data varchar(255) NOT NULL default '',
  PRIMARY KEY  (event_name)
);

# 
#-----[ SQL ]------------------------------------------ 
# 
#   If you have a different table prefix then change this command accordingly. 
#   I have used the default table prefix! 
# 
CREATE TABLE phpbb_cash_exchange (
  ex_cash_id1 int(11) NOT NULL default '0',
  ex_cash_id2 int(11) NOT NULL default '0',
  ex_cash_enabled int(1) NOT NULL default '0',
  PRIMARY KEY  (ex_cash_id1,ex_cash_id2)
);

# 
#-----[ SQL ]------------------------------------------ 
# 
#   If you have a different table prefix then change this command accordingly. 
#   I have used the default table prefix! 
# 
CREATE TABLE phpbb_cash_groups (
  group_id mediumint(6) NOT NULL default '0',
  group_type tinyint(2) NOT NULL default '0',
  cash_id smallint(6) NOT NULL default '0',
  cash_perpost int(11) NOT NULL default '0',
  cash_postbonus int(11) NOT NULL default '0',
  cash_perreply int(11) NOT NULL default '0',
  cash_perchar int(11) NOT NULL default '0',
  cash_maxearn int(11) NOT NULL default '0',
  cash_perpm int(11) NOT NULL default '0',
  cash_allowance tinyint(1) NOT NULL default '0',
  cash_allowanceamount int(11) NOT NULL default '0',
  cash_allowancetime tinyint(2) NOT NULL default '2',
  cash_allowancenext int(11) NOT NULL default '0',
  PRIMARY KEY  (group_id,group_type,cash_id)
);

# 
#-----[ SQL ]------------------------------------------ 
# 
#   If you have a different table prefix then change this command accordingly. 
#   I have used the default table prefix! 
# 
CREATE TABLE phpbb_cash_log (
  log_id int(11) NOT NULL auto_increment,
  log_time int(11) NOT NULL default '0',
  log_type smallint(6) NOT NULL default '0',
  log_action varchar(255) NOT NULL default '',
  log_text varchar(255) NOT NULL default '',
  PRIMARY KEY  (log_id)
);
Nomer 3
Код:
'CREATE TABLE '.BANNERS_TABLE.' (
banner_id MEDIUMINT(8) UNSIGNED NOT NULL, 
banner_name TEXT NOT NULL, 
banner_spot SMALLINT(1) UNSIGNED NOT NULL, 
banner_forum MEDIUMINT(8) UNSIGNED NOT NULL, 
banner_description VARCHAR(30) NOT NULL, 
banner_url VARCHAR(128) NOT NULL, 
banner_owner MEDIUMINT(8) NOT NULL, 
banner_click MEDIUMINT(8) UNSIGNED NOT NULL,
banner_view MEDIUMINT(8) UNSIGNED NOT NULL,
banner_weigth TINYINT(1) UNSIGNED DEFAULT "50" NOT NULL, 
banner_active TINYINT(1) NOT NULL, 
banner_timetype TINYINT(1) NOT NULL, 
time_begin INT(11) NOT NULL, 
time_end INT(11) NOT NULL, 
date_begin INT(11) NOT NULL, 
date_end INT(11) NOT NULL,
banner_level TINYINT(1) NOT NULL,
banner_level_type TINYINT(1) NOT NULL,
banner_comment VARCHAR(50) NOT NULL,
banner_type MEDIUMINT(5) NOT NULL, 
banner_width MEDIUMINT(5) UNSIGNED NOT NULL,
banner_height MEDIUMINT(5) UNSIGNED NOT NULL,
banner_filter TINYINT(1) NOT NULL,
banner_filter_time MEDIUMINT(5) DEFAULT "600" NOT NULL,
INDEX (banner_id))',

'CREATE TABLE '.BANNER_STATS_TABLE.' (
banner_id MEDIUMINT(8) UNSIGNED NOT NULL, 
click_date int (11) NOT NULL, 
click_ip char(8) NOT NULL, 
click_user MEDIUMINT(8) NOT NULL, 
user_duration int (11) NOT NULL)');
 
ако изчакаш малко ще ти дам код
трябва да стане така
правиш конект
после избилаш бд
след това с едно mysql_query()
вкарваш кода
почвам да ти пише код..
 
dan4o каза:
Дай ми направо всичко защото нищо не чаткам :(
ами насредата съм
само тва не знам какво е
'CREATE TABLE '.BANNERS_TABLE.' (
banner_id MEDIUMINT(8) UNSIGNED NOT NULL,
banner_name TEXT NOT NULL,
banner_spot SMALLINT(1) UNSIGNED NOT NULL,
banner_forum MEDIUMINT(8) UNSIGNED NOT NULL,
banner_description VARCHAR(30) NOT NULL,
banner_url VARCHAR(128) NOT NULL,
banner_owner MEDIUMINT(8) NOT NULL,
banner_click MEDIUMINT(8) UNSIGNED NOT NULL,
banner_view MEDIUMINT(8) UNSIGNED NOT NULL,
banner_weigth TINYINT(1) UNSIGNED DEFAULT "50" NOT NULL,
banner_active TINYINT(1) NOT NULL,
banner_timetype TINYINT(1) NOT NULL,
time_begin INT(11) NOT NULL,
time_end INT(11) NOT NULL,
date_begin INT(11) NOT NULL,
date_end INT(11) NOT NULL,
banner_level TINYINT(1) NOT NULL,
banner_level_type TINYINT(1) NOT NULL,
banner_comment VARCHAR(50) NOT NULL,
banner_type MEDIUMINT(5) NOT NULL,
banner_width MEDIUMINT(5) UNSIGNED NOT NULL,
banner_height MEDIUMINT(5) UNSIGNED NOT NULL,
banner_filter TINYINT(1) NOT NULL,
banner_filter_time MEDIUMINT(5) DEFAULT "600" NOT NULL,
INDEX (banner_id))',

'CREATE TABLE '.BANNER_STATS_TABLE.' (
banner_id MEDIUMINT(8) UNSIGNED NOT NULL,
click_date int (11) NOT NULL,
click_ip char(8) NOT NULL,
click_user MEDIUMINT(8) NOT NULL,
user_duration int (11) NOT NULL)');

от къде да знам как се казва тая '.BANNERS_TABLE.'
тва е някъв скрипт ама къв не мога да разбера

тва е като променлива ама не знам каква стаоност има :?
 
ето кода обаче това в горния ми пост го няма тук
<?php
$server = "localhost"; //тва ти е сървъра localhost ?
$user = "root"; //root ?
$pass = ""; //паса ти
$db = ""; //базата данни
$conn = mysql_connect("$server", "$user", "$pass")or die("сайта не може да се свърже към бд");
mysql_select_db($db, $conn)or die("грешна бд");
$query = mysql_query(" CREATE TABLE `phpbb_inline_ads` (
`ad_id` TINYINT( 5 ) NOT NULL auto_increment,
`ad_code` TEXT NOT NULL ,
`ad_name` CHAR( 25 ) NOT NULL,
PRIMARY KEY (`ad_id`)
);

INSERT INTO `phpbb_inline_ads` (`ad_id` , `ad_code`, `ad_name` )
VALUES
('1', 'Your banner code goes here', 'Default');

INSERT INTO `phpbb_config` ( `config_name` , `config_value` )
VALUES
('ad_after_post', '1'),
('ad_post_threshold', ''),
('ad_every_post', ''),
('ad_who', '1'),
('ad_no_forums', ''),
('ad_no_groups', ''),
('ad_old_style', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_disable',0);
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_display_after_posts',1);
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_post_message','You earned %s for that post');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_disable_spam_num',10);
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_disable_spam_time',24);
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_disable_spam_message','You have exceeded the alloted amount of posts and will not earn anything for your post');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_installed','yes');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_version','2.2.3');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_adminbig','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_adminnavbar','1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('points_name','Points');
CREATE TABLE phpbb_cash (
cash_id smallint(6) NOT NULL auto_increment,
cash_order smallint(6) NOT NULL default '0',
cash_settings smallint(4) NOT NULL default '3313',
cash_dbfield varchar(64) NOT NULL default '',
cash_name varchar(64) NOT NULL default 'GP',
cash_default int(11) NOT NULL default '0',
cash_decimals tinyint(2) NOT NULL default '0',
cash_imageurl varchar(255) NOT NULL default '',
cash_exchange int(11) NOT NULL default '1',
cash_perpost int(11) NOT NULL default '25',
cash_postbonus int(11) NOT NULL default '2',
cash_perreply int(11) NOT NULL default '25',
cash_maxearn int(11) NOT NULL default '75',
cash_perpm int(11) NOT NULL default '0',
cash_perchar int(11) NOT NULL default '20',
cash_allowance tinyint(1) NOT NULL default '0',
cash_allowanceamount int(11) NOT NULL default '0',
cash_allowancetime tinyint(2) NOT NULL default '2',
cash_allowancenext int(11) NOT NULL default '0',
cash_forumlist varchar(255) NOT NULL default '',
PRIMARY KEY (cash_id)
);
CREATE TABLE phpbb_cash_events (
event_name varchar(32) NOT NULL default '',
event_data varchar(255) NOT NULL default '',
PRIMARY KEY (event_name)
);
CREATE TABLE phpbb_cash_exchange (
ex_cash_id1 int(11) NOT NULL default '0',
ex_cash_id2 int(11) NOT NULL default '0',
ex_cash_enabled int(1) NOT NULL default '0',
PRIMARY KEY (ex_cash_id1,ex_cash_id2)
);
CREATE TABLE phpbb_cash_groups (
group_id mediumint(6) NOT NULL default '0',
group_type tinyint(2) NOT NULL default '0',
cash_id smallint(6) NOT NULL default '0',
cash_perpost int(11) NOT NULL default '0',
cash_postbonus int(11) NOT NULL default '0',
cash_perreply int(11) NOT NULL default '0',
cash_perchar int(11) NOT NULL default '0',
cash_maxearn int(11) NOT NULL default '0',
cash_perpm int(11) NOT NULL default '0',
cash_allowance tinyint(1) NOT NULL default '0',
cash_allowanceamount int(11) NOT NULL default '0',
cash_allowancetime tinyint(2) NOT NULL default '2',
cash_allowancenext int(11) NOT NULL default '0',
PRIMARY KEY (group_id,group_type,cash_id)
);
CREATE TABLE phpbb_cash_log (
log_id int(11) NOT NULL auto_increment,
log_time int(11) NOT NULL default '0',
log_type smallint(6) NOT NULL default '0',
log_action varchar(255) NOT NULL default '',
log_text varchar(255) NOT NULL default '',
PRIMARY KEY (log_id)
);
");
if ($query) {
echo "вие успешно ъпдейтнахте база данни";
} else {
echo "неуспех";
}
?>
 
renegat96 това няма да работи, мисля че в едно mysql_query не можеш да вкараш всичко. Ето ти примерче как да ги сглобиш.

Код:
<?php
$server = "localhost"; //тва ти е сървъра localhost ?
$user = "root"; //root ?
$pass = "**"; //паса ти
$db = "**"; //базата данни
$conn = mysql_connect("$server", "$user", "$pass")or die("сайта не може да се свърже към бд");
mysql_select_db($db, $conn)or die("грешна бд");
$query = mysql_query(" 
CREATE TABLE `phpbb_inline_ads` (
`ad_id` TINYINT( 5 ) NOT NULL auto_increment,
`ad_code` TEXT NOT NULL ,
`ad_name` CHAR( 25 ) NOT NULL,
PRIMARY KEY (`ad_id`)
);
");
$query1 = mysql_query("
INSERT INTO `phpbb_inline_ads` (`ad_id` , `ad_code`, `ad_name` )
VALUES
('1', 'Your banner code goes here', 'Default'); 
");
?>
 
Galli каза:
renegat96 това няма да работи, мисля че в едно mysql_query не можеш да вкараш всичко. Ето ти примерче как да ги сглобиш.

Код:
<?php
$server = "localhost"; //тва ти е сървъра localhost ?
$user = "root"; //root ?
$pass = "**"; //паса ти
$db = "**"; //базата данни
$conn = mysql_connect("$server", "$user", "$pass")or die("сайта не може да се свърже към бд");
mysql_select_db($db, $conn)or die("грешна бд");
$query = mysql_query(" 
CREATE TABLE `phpbb_inline_ads` (
`ad_id` TINYINT( 5 ) NOT NULL auto_increment,
`ad_code` TEXT NOT NULL ,
`ad_name` CHAR( 25 ) NOT NULL,
PRIMARY KEY (`ad_id`)
);
");
$query1 = mysql_query("
INSERT INTO `phpbb_inline_ads` (`ad_id` , `ad_code`, `ad_name` )
VALUES
('1', 'Your banner code goes here', 'Default'); 
");
?>


защо да не работи ?
добре, щом казваш ще ги сглобя и така... :roll:
 
така...понеже Galli ме сряза че съм ги събрал в едно mysql_query
и аз го направих както той ми каза
ето кода...
<?php
$server = "localhost"; //тва ти е сървъра localhost ?
$user = "root"; //root ?
$pass = ""; //паса ти
$db = ""; //базата данни
$conn = mysql_connect("$server", "$user", "$pass")or die("сайта не може да се свърже към бд");
mysql_select_db($db, $conn)or die("грешна бд");
$query = mysql_query("
CREATE TABLE `phpbb_inline_ads` (
`ad_id` TINYINT( 5 ) NOT NULL auto_increment,
`ad_code` TEXT NOT NULL ,
`ad_name` CHAR( 25 ) NOT NULL,
PRIMARY KEY (`ad_id`)
);
");
$query .= mysql_query("
INSERT INTO `phpbb_inline_ads` (`ad_id` , `ad_code`, `ad_name` )
VALUES
('1', 'Your banner code goes here', 'Default');
");
$query .= mysql_query("
INSERT INTO `phpbb_config` ( `config_name` , `config_value` )
VALUES
('ad_after_post', '1'),
('ad_post_threshold', ''),
('ad_every_post', ''),
('ad_who', '1'),
('ad_no_forums', ''),
('ad_no_groups', ''),
('ad_old_style', '1');
");
$query .= mysql_query("INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_disable',0);
");
$query .= mysql_query("INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_display_after_posts',1);
");
$query .= mysql_query("INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_post_message','You earned %s for that post');
");
$query .= mysql_query("INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_disable_spam_num',10);
");
$query .= mysql_query("INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_disable_spam_time',24);
");
$query .= mysql_query("INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_disable_spam_message','You have exceeded the alloted amount of posts and will not earn anything for your post');
");
$query .= mysql_query("INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_installed','yes');
");
$query .= mysql_query("INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_version','2.2.3');
");
$query .= mysql_query("INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_adminbig','0');
");
$query .= mysql_query("INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_adminnavbar','1');
");
$query .= mysql_query("INSERT INTO phpbb_config (config_name, config_value) VALUES ('points_name','Points');
");
$query .= mysql_query("CREATE TABLE phpbb_cash (
cash_id smallint(6) NOT NULL auto_increment,
cash_order smallint(6) NOT NULL default '0',
cash_settings smallint(4) NOT NULL default '3313',
cash_dbfield varchar(64) NOT NULL default '',
cash_name varchar(64) NOT NULL default 'GP',
cash_default int(11) NOT NULL default '0',
cash_decimals tinyint(2) NOT NULL default '0',
cash_imageurl varchar(255) NOT NULL default '',
cash_exchange int(11) NOT NULL default '1',
cash_perpost int(11) NOT NULL default '25',
cash_postbonus int(11) NOT NULL default '2',
cash_perreply int(11) NOT NULL default '25',
cash_maxearn int(11) NOT NULL default '75',
cash_perpm int(11) NOT NULL default '0',
cash_perchar int(11) NOT NULL default '20',
cash_allowance tinyint(1) NOT NULL default '0',
cash_allowanceamount int(11) NOT NULL default '0',
cash_allowancetime tinyint(2) NOT NULL default '2',
cash_allowancenext int(11) NOT NULL default '0',
cash_forumlist varchar(255) NOT NULL default '',
PRIMARY KEY (cash_id)
);
");
$query .= mysql_query("
CREATE TABLE phpbb_cash_events (
event_name varchar(32) NOT NULL default '',
event_data varchar(255) NOT NULL default '',
PRIMARY KEY (event_name)
);
");
$query .= mysql_query("
CREATE TABLE phpbb_cash_exchange (
ex_cash_id1 int(11) NOT NULL default '0',
ex_cash_id2 int(11) NOT NULL default '0',
ex_cash_enabled int(1) NOT NULL default '0',
PRIMARY KEY (ex_cash_id1,ex_cash_id2)
);
");
$query .= mysql_query("
CREATE TABLE phpbb_cash_groups (
group_id mediumint(6) NOT NULL default '0',
group_type tinyint(2) NOT NULL default '0',
cash_id smallint(6) NOT NULL default '0',
cash_perpost int(11) NOT NULL default '0',
cash_postbonus int(11) NOT NULL default '0',
cash_perreply int(11) NOT NULL default '0',
cash_perchar int(11) NOT NULL default '0',
cash_maxearn int(11) NOT NULL default '0',
cash_perpm int(11) NOT NULL default '0',
cash_allowance tinyint(1) NOT NULL default '0',
cash_allowanceamount int(11) NOT NULL default '0',
cash_allowancetime tinyint(2) NOT NULL default '2',
cash_allowancenext int(11) NOT NULL default '0',
PRIMARY KEY (group_id,group_type,cash_id)
);
");
$query .= mysql_query("
CREATE TABLE phpbb_cash_log (
log_id int(11) NOT NULL auto_increment,
log_time int(11) NOT NULL default '0',
log_type smallint(6) NOT NULL default '0',
log_action varchar(255) NOT NULL default '',
log_text varchar(255) NOT NULL default '',
PRIMARY KEY (log_id)
);
");
if ($query) {
echo "вие успешно ъпдейтнахте база данни";
} else {
echo "неуспех";
}
?>
 
Какво да направя добавих още няколко SQl и ми изкара ерор
Код:
Parse error: parse error, unexpected T_LNUMBER in /home/www/localhost/data.php on line 132
А на 132 ред има
Код:
banner_weigth TINYINT(1) UNSIGNED DEFAULT "50" NOT NULL,
 
Код:
banner_weigth TINYINT(1) UNSIGNED DEFAULT \"50\" NOT NULL,
 

Back
Горе