TinyPortal

Development => Support => Topic started by: Nokonium on April 29, 2005, 11:48:59 PM

Title: Database problem with two TP's on one database
Post by: Nokonium on April 29, 2005, 11:48:59 PM
I already had a TP test running, own folder and own table prefix, when I tried to install TP on another test board, again own folder and own table prefix. There were problems with the resulting SMF+TP so I uninstalled it. The uninstall exposed a problem with the other installation:

Table '##########.tportal_settings' doesn't exist
File: /[munge]/Sources/TPortal.php
Line: 46

It looks to me like the second install overwrote the first table entries and deleted all of them on the uninstall.
Title: Re: Database problem with two TP's on one database
Post by: Bjørn on April 30, 2005, 01:49:52 AM
Yes..I am afraid the tables for TP is with a set prefix. So if you install multiple TP+SMF on the same database, there will be errors.

I might add this in future versions though.
Title: Re: Database problem with two TP's on one database
Post by: Nokonium on April 30, 2005, 07:37:57 AM
Thanks Bloc
Title: Re: Database problem with two TP's on one database
Post by: borgBOB on April 30, 2005, 08:11:08 AM
Bloc, I have 3 installs of SMF with TP on the same server, and no problems. :)  All are in the same root directory, and all have seperate databases in MySQL.

Check my profile for specs.
Title: Re: Database problem with two TP's on one database
Post by: Nokonium on April 30, 2005, 08:33:17 AM
I only have one database available, so I can only use different table prefixes for the different instalations.
Title: Re: Database problem with two TP's on one database
Post by: Bjørn on April 30, 2005, 09:43:54 AM
I will see if I can make all calls to the tportal_xxx tables use a settable prefix. That way you can at least set a new prefix in one place, change it physically in the databse, and just install a new version with the normal prefix. And so on.
Title: Re: Database problem with two TP's on one database
Post by: hivelord on April 30, 2005, 09:48:17 AM
Quote from: nokonium on April 30, 2005, 08:33:17 AM
I only have one database available, so I can only use different table prefixes for the different instalations.

Out of personal interest, why do you only have 1 database? Is it your hosting deal?
Title: Re: Database problem with two TP's on one database
Post by: Nokonium on April 30, 2005, 12:41:24 PM
Quote from: hivelord on April 30, 2005, 09:48:17 AM
Quote from: nokonium on April 30, 2005, 08:33:17 AM
I only have one database available, so I can only use different table prefixes for the different instalations.

Is it your hosting deal?

Yes
Title: Re: Database problem with two TP's on one database
Post by: Nokonium on April 30, 2005, 12:42:12 PM
Quote from: Bloc on April 30, 2005, 09:43:54 AM
I will see if I can make all calls to the tportal_xxx tables use a settable prefix. That way you can at least set a new prefix in one place, change it physically in the databse, and just install a new version with the normal prefix. And so on.

Thanks Bloc
Title: Re: Database problem with two TP's on one database
Post by: Kindred on May 02, 2005, 08:35:32 PM
Bloc,  what if you just append the SMF prefix from the smf instance?

so, default would be smf_tportal_
if you has a second smf installed, in the same database using jpw as the prefix, the call would go to jpw_tportal_



so call for
FROM $db_prefix.tportal_settings
instead of just
FROM tportal_settings
Title: Re: Database problem with two TP's on one database
Post by: Bjørn on May 02, 2005, 10:39:34 PM
Good suggestion. But since many now has the original names, I have just changed the code to have the prefix defined 3 places, one in TPortal.php, one in TPortalAdmin.php and finally one in TPModules.php.

This way will make it easier to use several intances of the portal, just renaming the tables, and then change the prefix, and all is good.

And for those that don't need this, it will just work as before.
Title: Re: Database problem with two TP's on one database
Post by: Nokonium on May 03, 2005, 06:33:27 AM
What do I need to do now?

Do you mean that 0.6beta has been ammended and I should download and install the newer version?

Then how do I change the prefixes?

Title: Re: Database problem with two TP's on one database
Post by: Bjørn on May 03, 2005, 08:12:34 AM
I have changed it for v0.7beta.

But I can change it just for v.0.6 temporarily, if you need it faster.
Title: Re: Database problem with two TP's on one database
Post by: Nokonium on May 03, 2005, 01:04:38 PM
If you could let me have an ammended copy of 0.6 that would be much appreciated.

Thanks Bloc
Title: Re: Database problem with two TP's on one database
Post by: Bjørn on May 03, 2005, 01:46:54 PM
These are the modified v0.6 beta files, with settable prefix.

I suggest overwriting your existing file( set a new prefix first, look for "// tportal prefix"), then just renaming the tables. Check if it works OK.

Then install a new version of TP on another SMF, which now will use the original "tportal_"  prefix. Do the same again, if you need more installations on the same database.


Title: Re: Database problem with two TP's on one database
Post by: Nokonium on May 03, 2005, 05:34:44 PM
Thanks Bloc, be back when I've had a fiddle  ;D
Title: Re: Database problem with two TP's on one database
Post by: Nokonium on May 12, 2005, 09:03:48 PM
Had a little fiddle, all is going well, but.....

Table 'db119726169.tportal_blocks' doesn't exist
File: /homepages/6/d119724375/htdocs/sgr/Sources/TPortalAdmin.php
Line: 83

This is Line 83 $request = db_query("SELECT * FROM tportal_blocks WHERE id=$val", __FILE__, __LINE__);

It looks like I need to alter the tportal to my prefix.

Off to fiddle some more....  ;D