php forum
php mysql forum
php mysql smarty
 
Topic Options
#253149 - 07/08/03 04:53 AM Accessing a second database and UBBThreads
s4dreamer Offline
Lurker

Registered: 03/25/03
Posts: 6
Loc: Sheffield, UK

   Accessing a second database and UBBThreads to Del.icio.us Add to del.icio.us
  Digg Accessing a second database and UBBThreads Digg it
I have a wierd problem which has just started since our admin upgraded our server. <br /> <br />Current s/w versions are UBB6.2.3, PHP 4.3.1, MySQL 3.23.49, Apache 1.3.27 <br /> <br />I have written a package which uses the UBB user-id for the username. So, the first thing I do is to check the UBB authentication of the user: <br />
Code:
 <br />require ("/blah/ubbthreads/main.inc.php"); <br />require ("/blah/ubbthreads/languages/${$config['cookieprefix']."w3t_language"}/ubbthreads.php"); <br /> <br />$userob = new user; <br />$user = $userob -&gt; authenticate("U_Username,U_PicturePosts,U_ShowSigs,U_Email,U_PictureView, <br />U_Status,U_Privates,U_Name,U_Title,U_Totalposts,U_Visible, U_Laston,U_Language,U_TimeOffset, <br />U_Groups,U_Picture,U_Number"); <br /> <br />$html = new html; <br />
<br /> <br />Once this is done, I load my code and login to the db with a separate user and select my database: <br />
Code:
 <br />require_once("mycode.php"); <br /> <br />$db = mysql_connect("localhost", $dbuser, $dbpass); <br />mysql_select_db("mydb", $db); <br />
<br /> <br />Now, the problem is that when the UBB authenticate() function is called, it makes a query on the database. However, the db query fails because it appears to be attempting to access "mydb.xxxxx" (sorry, can't recall the table name off-hand). The issue is that is appears to be trying to use mydb rather than the UBB database - even though the mysql_select_db() has not yet been run to connect to mydb. <br /> <br />From what I can tell from the PHP/MySQL status, there is a single persistent connection to MySQL, which I assume belongs to UBB. <br /> <br />This all worked fine before the upgrade, but I can't think for the life of me why it is failing now. <br /> <br />Anyone got any ideas of why it is failing or things I might try ?

Top
#253150 - 07/08/03 05:00 AM Re: Accessing a second database and UBBThreads [Re: donald]
s4dreamer Offline
Lurker

Registered: 03/25/03
Posts: 6
Loc: Sheffield, UK
I think I should add that UBB works fine on its own.

Top
#253151 - 07/09/03 10:33 AM Re: Accessing a second database and UBBThreads [Re: donald]
s4dreamer Offline
Lurker

Registered: 03/25/03
Posts: 6
Loc: Sheffield, UK
Ah, I now have the answer to this problem.<br /><br />The sysadmin had given the UBBThreads db the same login id and password as my database, so they had ended up sharing the connection which became a problem when my code selected a different database.<br /><br />Fixed by adding an extra parameter to mysql_connect in my code:<br /><br />$db = mysql_connect("localhost", $dbuser, $dbpass, true);

Top


Who's Online
0 Registered (), 19 Guests and 5 Spiders online.
Key: Admin, Global Mod, Mod
Shout Box

Latest Posts
Blogs, love em or hate em?
by AllenAyres
Yesterday at 02:05 PM
What do you use to edit the files
by Ian_W
10/05/08 03:33 PM
BeyondCompare v3.00
by Ian_W
10/05/08 03:32 PM
Glossy Black Theme with Image Reflection
by Gizmo
10/05/08 02:17 PM
ShareThis
by Gizmo
09/28/08 05:06 AM
[7.3] Viewing MySQL logfiles made easier
by AllenAyres
09/27/08 09:57 PM
Looking for a simple upload script
by Murphdog
09/26/08 08:45 PM
New Mods
[7.3] Viewing MySQL logfiles made easier
by blaaskaak
09/24/08 05:39 PM
[7.3] Language file checker
by blaaskaak
09/09/08 12:56 AM
[7.3.1] add search to showmembers page
by blaaskaak
09/07/08 04:50 AM
Multiple Identity Detector
by
12/30/06 06:39 PM
Newest Members
pisa666, ghengis317, NitroX, Dogan, EliYah-
13345 Registered Users
Top Posters Last 30 Days
blaaskaak 12
AllenAyres 10
FREAK1 7
Mike L_dup1 4
Chris Bale 4
Ian_W 4
tackaberry 4

 

 

 
fusionbb message board php hacks