SMF Ads Support Forum

Support => General Support => Topic started by: cazador on March 18, 2007, 10:23:37 AM

Title: problem with de DB
Post by: cazador on March 18, 2007, 10:23:37 AM
Hello guys
I got a problem with the ad manager mod. I Installed it manual, but I don't know how to do the DB, I'll try it by the packages admi, and all the pages of the forum turn white. Everything desapear.
I got de default theme, an the dir It's this http://argentronicap2p.ueuo.com/

help me please, I don't know what to do, or the way to create de DB tables

<?php

/*
Installing the ad mod for the first time
*/
db_query("
CREATE TABLE IF NOT EXISTS 
{$db_prefix}ads (
ADS_ID mediumint(8) unsigned NOT NULL auto_increment,
NAME tinytext NOT NULL,
CONTENT text NOT NULL,
BOARDS tinytext,
POSTS tinytext,
HITS mediumint(8) NOT NULL default '0',
TYPE smallint(4) NOT NULL default '0',
show_index smallint(4) NOT NULL default '0',
show_board smallint(4) NOT NULL default '0',
show_threadindex smallint(4) NOT NULL default '0',
show_lastpost smallint(4) NOT NULL default '0',
show_thread smallint(4) NOT NULL default '0',
show_bottom smallint(4) NOT NULL default '0',
show_welcome smallint(4) NOT NULL default '0',
show_topofpage smallint(4) NOT NULL default '0',
show_towerright smallint(4) NOT NULL default '0',
show_towerleft smallint(4) NOT NULL default '0',
show_betweencategories smallint(4) NOT NULL default '0',
show_underchildren smallint(4) NOT NULL default '0',
PRIMARY KEY (ADS_ID)
)"
__FILE____LINE__);

db_query("
CREATE TABLE IF NOT EXISTS 
{$db_prefix}ads_settings (
  variable tinytext NOT NULL,
  value text NOT NULL,
  PRIMARY KEY (variable(30))
)"
__FILE____LINE__);

/*
If you've already had the mod installed this will just make sure that you have the most current version of the database
*/
$result db_query("SHOW COLUMNS FROM {$db_prefix}ads LIKE 'show_lastpost'"__FILE____LINE__);
if (
mysql_num_rows($result) == 0)
db_query("
ALTER IGNORE TABLE 
{$db_prefix}ads
ADD show_lastpost smallint(4) NOT NULL default '0' AFTER show_threadindex"
__FILE____LINE__);

$result db_query("SHOW COLUMNS FROM {$db_prefix}ads LIKE 'CATEGORY'"__FILE____LINE__);
if (
mysql_num_rows($result) == 0)
db_query("
ALTER IGNORE TABLE 
{$db_prefix}ads
ADD CATEGORY tinytext AFTER POSTS"
__FILE____LINE__);

$result db_query("SHOW COLUMNS FROM {$db_prefix}ads LIKE 'show_underchildren'"__FILE____LINE__);
if (
mysql_num_rows($result) == 0)
db_query("
ALTER IGNORE TABLE 
{$db_prefix}ads
ADD show_underchildren smallint(4) NOT NULL default '0'"
__FILE____LINE__);


/*
Inserts into the settings table
*/
db_query("
INSERT IGNORE INTO 
{$db_prefix}settings
(variable, value)
VALUES ('ads_displayAdsAdmin', '0'),
('ads_updateReports', '0'),
('ads_quickDisable', '0'),
('ads_lookLikePosts', '1')"
__FILE____LINE__);
?>




Thanks
Title: Re: problem with de DB
Post by: bigguy on March 20, 2007, 02:14:02 AM
I will leave this for Jerm to answer as he may know better.
Title: Re: problem with de DB
Post by: jerm on March 20, 2007, 11:19:27 PM
You'll need to use phpmyadmin and add this to your smf table:

CREATE TABLE IF NOT EXISTS {$db_prefix}ads (
ADS_ID mediumint(8) unsigned NOT NULL auto_increment,
NAME tinytext NOT NULL,
CONTENT text NOT NULL,
BOARDS tinytext,
POSTS tinytext,
HITS mediumint(8) NOT NULL default '0',
TYPE smallint(4) NOT NULL default '0',
show_index smallint(4) NOT NULL default '0',
show_board smallint(4) NOT NULL default '0',
show_threadindex smallint(4) NOT NULL default '0',
show_lastpost smallint(4) NOT NULL default '0',
show_thread smallint(4) NOT NULL default '0',
show_bottom smallint(4) NOT NULL default '0',
show_welcome smallint(4) NOT NULL default '0',
show_topofpage smallint(4) NOT NULL default '0',
show_towerright smallint(4) NOT NULL default '0',
show_towerleft smallint(4) NOT NULL default '0',
show_betweencategories smallint(4) NOT NULL default '0',
show_underchildren smallint(4) NOT NULL default '0',
PRIMARY KEY (ADS_ID)
)
Title: Same question.
Post by: anakmacan on June 01, 2007, 08:53:22 AM
can you help us for each step, uploading the data in install.php to database?
Ive opened my phpmyadmin, then open my smf database, but i dont know what to do next. When i tried copying like you said from "Sql" (Run SQL query/queries on database), i got error message.

How do we add all of them into our db?
Quote<?php

/*
Installing the ad mod for the first time
*/
mysql_query("
CREATE TABLE IF NOT EXISTS 
{$db_prefix}ads (
ADS_ID mediumint(8) unsigned NOT NULL auto_increment,
NAME tinytext NOT NULL,
CONTENT text NOT NULL,
BOARDS tinytext,
POSTS tinytext,
HITS mediumint(8) NOT NULL default '0',
TYPE smallint(4) NOT NULL default '0',
show_index smallint(4) NOT NULL default '0',
show_board smallint(4) NOT NULL default '0',
show_threadindex smallint(4) NOT NULL default '0',
show_lastpost smallint(4) NOT NULL default '0',
show_thread smallint(4) NOT NULL default '0',
show_bottom smallint(4) NOT NULL default '0',
show_welcome smallint(4) NOT NULL default '0',
show_topofpage smallint(4) NOT NULL default '0',
show_towerright smallint(4) NOT NULL default '0',
show_towerleft smallint(4) NOT NULL default '0',
show_betweencategories smallint(4) NOT NULL default '0',
show_underchildren smallint(4) NOT NULL default '0',
PRIMARY KEY (ADS_ID)
)"
__FILE____LINE__);

mysql_query("
CREATE TABLE IF NOT EXISTS 
{$db_prefix}ads_settings (
  variable tinytext NOT NULL,
  value text NOT NULL,
  PRIMARY KEY (variable(30))
)"
__FILE____LINE__);

/*
If you've already had the mod installed this will just make sure that you have the most current version of the database
*/
$result mysql_query("SHOW COLUMNS FROM {$db_prefix}ads LIKE 'show_lastpost'"__FILE____LINE__);
if (
mysql_num_rows($result) == 0)
mysql_query("
ALTER IGNORE TABLE 
{$db_prefix}ads
ADD show_lastpost smallint(4) NOT NULL default '0' AFTER show_threadindex"
__FILE____LINE__);

$result mysql_query("SHOW COLUMNS FROM {$db_prefix}ads LIKE 'CATEGORY'"__FILE____LINE__);
if (
mysql_num_rows($result) == 0)
mysql_query("
ALTER IGNORE TABLE 
{$db_prefix}ads
ADD CATEGORY tinytext AFTER POSTS"
__FILE____LINE__);

$result mysql_query("SHOW COLUMNS FROM {$db_prefix}ads LIKE 'show_underchildren'"__FILE____LINE__);
if (
mysql_num_rows($result) == 0)
mysql_query("
ALTER IGNORE TABLE 
{$db_prefix}ads
ADD show_underchildren smallint(4) NOT NULL default '0'"
__FILE____LINE__);


/*
Inserts into the settings table
*/
mysql_query("
INSERT IGNORE INTO 
{$db_prefix}settings
(variable, value)
VALUES ('ads_displayAdsAdmin', '0'),
('ads_updateReports', '0'),
('ads_quickDisable', '0'),
('ads_lookLikePosts', '1')"
__FILE____LINE__);
?>

Title: Re: problem with de DB
Post by: ITA003 on June 01, 2007, 09:11:13 AM
Do you have problem with Package install procedure?
Title: Re: problem with de DB
Post by: anakmacan on June 01, 2007, 06:33:34 PM
Yep, i installed at first, but since it didnt work well i uninstall it, after that i cant install anymore package (dunno what i did wrong) o_O Ive edited all theme files now all i have to do is to add those tables,etc into mysql, i just dont know how to do it  ::)
Title: Re: problem with de DB
Post by: anakmacan on June 01, 2007, 06:37:05 PM
So, basically im just clueless, anyone wanna give me a hand? pls? :-\ mammamia..  :'(
Title: Re: problem with de DB
Post by: ITA003 on June 02, 2007, 03:59:23 AM
Ok.

From PhpMyAdmin you must execute these query, be careful to this php variable {$db_prefix} (present in all query), you must replace it with your SMF Table prefix (usually smf_):

CREATE TABLE IF NOT EXISTS {$db_prefix}ads (
ADS_ID mediumint(8) unsigned NOT NULL auto_increment,
NAME tinytext NOT NULL,
CONTENT text NOT NULL,
BOARDS tinytext,
POSTS tinytext,
HITS mediumint(8) NOT NULL default '0',
TYPE smallint(4) NOT NULL default '0',
show_index smallint(4) NOT NULL default '0',
show_board smallint(4) NOT NULL default '0',
show_threadindex smallint(4) NOT NULL default '0',
show_lastpost smallint(4) NOT NULL default '0',
show_thread smallint(4) NOT NULL default '0',
show_bottom smallint(4) NOT NULL default '0',
show_welcome smallint(4) NOT NULL default '0',
show_topofpage smallint(4) NOT NULL default '0',
show_towerright smallint(4) NOT NULL default '0',
show_towerleft smallint(4) NOT NULL default '0',
show_betweencategories smallint(4) NOT NULL default '0',
show_underchildren smallint(4) NOT NULL default '0',
PRIMARY KEY (ADS_ID)


CREATE TABLE IF NOT EXISTS {$db_prefix}ads_settings (
  variable tinytext NOT NULL,
  value text NOT NULL,
  PRIMARY KEY (variable(30))


INSERT IGNORE INTO {$db_prefix}settings
(variable, value)
VALUES ('ads_displayAdsAdmin', '0'),
('ads_updateReports', '0'),
('ads_quickDisable', '0'),
('ads_lookLikePosts', '1')