FRIHOST • FORUMS • SEARCH • FAQ • TOS • BLOGS • COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


[PHP] phpbb registration - add to other db





mathiaus
Right I'm working on a sort of integration thingy but I need data in 2 databases. During forum registation i would like to add data to a second database. However I seem unable to.

what I'm doing ....
under the variable sql holding the inser for the data for the use in the forum i have
Code:
         ////////////////////////////////////////////////////
         $userfanreg="yes";
         $fanuser_id=$user_id;
         $fanusername=$username;
         $fannew_password=$new_password;
         $fnaemail=$email;
         ////////////////////////////////////////////////////

and later on under the wpm mod


Code:
               if ($userfanreg=="yes") {
         ////////////////////////////////////////////////////
            include('/home/mathiaus/public_html/cookies.php');
            registerfan($fanuser_id, $fanusername, $fannew_password, $fnaemail);
         ////////////////////////////////////////////////////
         }



in my cookies.php file have 3 functions the one I'm using is
Code:
// REGISTER USER IN FAN SECION
function registerfan($auser_id, $ausername, $anew_password, $aemail) {
include ("/home/mathiaus/public_html/fan/data/dbconfig.php");

if (mysql_query("INSERT INTO fanfiction_authors (uid, penname, realname, bio, email, website, date, password, userskin) VALUES ('$auser_id', '$ausername', '', '', '$aemail', '', '".time()."', '$anew_password', '0' 'Efiction')"))
setcookie("registeredatfan", "yes", time()+100000, '/', 'siriusblacks.com');
mysql_close($mysql_access);

}


and the dbconfig.php is
Code:
<?php

$fdbhost = 'localhost';
$fdbuser = 'mathiaus_Sirius';
$fdbpass = 'mfs938';
$fdbname = 'mathiaus_efiction';

$mysql_access = mysql_connect($fdbhost, $fdbuser, $fdbpass);
mysql_select_db($fdbname, $mysql_access);

?>

I changed that so they werent the same as the forums.

Basicly what i want to know is how I can add this data to the other database without a this error
Quote:
Could not obtain user/day information

Line : 286
File : /home/mathiaus/public_html/forum/includes/page_header.php
SQL : SELECT user_id, username, user_allow_viewonline, user_level, user_session_time FROM phpbb_users WHERE user_id > 0 ORDER BY user_level DESC, username ASC

It may have something to do with the templating system when I see it using $result = $db->sql_query($sql, BEGIN_TRANSACTION)

Any help would be appreciated as i really can't do stuff with templates. They confuse me Embarassed
comp615
It's really hard to understand what your talking about...but to insert data into another db all you'd have to do would be use mysql_select_db(), to change to the other db...insert stuff...and change it back.

mysql_select_db(Newdb, $datahandle);
mysql_query(Insert statement);
mysql_select_db(olddb, $datahandle);

May want to take ur password out of that post too Smile We'll assume you got that rightl.
mathiaus
naturally the pass was changed Very Happy
Well it worked thanks. Why I didnt even try this I just don't know Embarassed

-close-
Related topics
does the firhost.net php server have PEAR?
SQL and PHP
best frihost website layout/design/functionality
Latest PHP install may cause phpBB to return errors...
phpBB - Installation Tutorial
phpBB2 - Installing Templates/Skins
myBBoard - Installation Tutorial
Portal for web designers
Joomla! - Installation Tutorial
Fixing 'Can't Connect to database' errors with phpBB.
Can΄t connect to my database with php-nuke
PhpNuke Installation Tutorial
Joomla Support
PhpBB Registration Issue?
This topic is locked: you cannot edit posts or make replies.    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.