News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Database Problem

Started by smithy, April 24, 2007, 12:36:22 PM

Previous topic - Next topic

smithy

Hello,
I have just installed another smf forum. My 3rd infact. Anyway Rather that just install the forum, get members to it then start playing around with it. I decided i want to do all the changers first before getting users to it. Now i got my nice new forum and a nice theme. Added nice buttons and stuff and its starting to look good.

I tried to install the Ad Mod but my server wont let it. Server paths are correct so something is blocking me from installing mods on the forum.

I then search the forum for a manual install of mods which i found. Great i thought! Altered all the files with the ad before, after and replace. Piece of cake untill a realised i still had to install the database for that particular mod. I then checked the install.php for the database tables but it didnt look like any sql.txt file i have seen before but i thought i would give it a shot. Nope not in a million years will i get the tables installed. There must be something i should do or alter to get this thing working?

The install.php looks like this

<?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 (
&#160; variable tinytext NOT NULL,
&#160; value text NOT NULL,
&#160; 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__);
?>


I guess its the first 2 tables i have to install but i keep getting mysql said syntex errors.

Can somebody kindly tell me what i must do to get the tables installed.

Thanks
smithy

Allways say thanks to the people who help you. It p----s me off when people ask for help and cant say a simple thank you. Its just nice to be nice.

Kindred

1- please use the code tags...

2- that is a PHP file designed to run SQL commands, using the SMF SQL parser function.


If you want to run those manually, you will have to replace {$db_prefix} with your database prefix and copy thr section inside the db_query quotes...

Alternatively, you can upload the php file and run it by browsing directly to it...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

smithy

#2
Thanks for the reply.
I did lauch the install.php file but i get this error.

Fatal error: Call to undefined function: db_query() in /home/user/domains/mydomain.com/public_html/Packages/ad_mod_1-1-x_v2-3/install.php on line 6

Sorry, i dont realy understand what you mean by this.

If you want to run those manually, you will have to replace {$db_prefix} with your database prefix and copy thr section inside the db_query quotes.

Cheers
smithy

Allways say thanks to the people who help you. It p----s me off when people ask for help and cant say a simple thank you. Its just nice to be nice.

Kindred

for example:


CREATE TABLE IF NOT EXISTS smf_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)
);
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

smithy

Thank you guys. It worked :) Atleast i will know what to do next time.

Cheers
smithy
Allways say thanks to the people who help you. It p----s me off when people ask for help and cant say a simple thank you. Its just nice to be nice.

Advertisement: