Date: 10/19/00
- Next message: Matt Friedman: "[phplib] Help with set block in templates please."
- Previous message: TRINHL <email protected>: "[phplib] Some help please !!"
- In reply to: TRINHL <email protected>: "[phplib] Some help please !!"
- Next in thread: Michael Geißler: "AW: [phplib] Some help please !!"
- Reply: Michael Geißler: "AW: [phplib] Some help please !!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
i belive your problem lies with the database use statment in the
db_mysql class it has been discused b 4, and i rem reading notes about
it. when it opens the session makes connection to mysql server then uses
a use this data base stament after it opens the connection. then you
open the next connection it does the same, but now when you go back to
the first db var the database connection is already open so it never
reissues the use this db stuff so the connection stays with the last
mysql db opened.
havent tried this with postgresql, at least not on the same sever that
would be the other work around i think is to use a different sever or
server name for the second db connection, or hack n slash the db_mysql
class to always reissue use this db b 4 every query
hope this helps
TRINHL <email protected> wrote:
>
> To whom this may concern,
>
> I'm a "newbie" with PHPLIB. I would appreciate some help in understanding
> what may be causing the following problem. I have a simple PHP script page
> to INSERT a data record into a MySQL database table. I'd also like to have
> some Authentication capability on this page. Here is the code:
>
> <?
> page_open(array("sess" => "Valid_Session"));
> $db = new DB_Members;
> $sql = sprintf("INSERT INTO Members (FirstName, Lastname, Email,
> AreaCode, Phone, Company, BusAddress, BusCity,
> BusState, BusZip, BusCountry, BusAreaCode, BusPhone,
> BusFaxAreaCode, BusFaxNo, UserID, Password)
> VALUES ('$first_name', '$last_name', '$email_addr',
> '$area_code', '$phone_no', '$company_name',
> '$business_address', '$business_city',
> '$business_state', '$business_zip',
> '$business_country',
> '$bus_area_code', '$business_phone',
> '$bus_fax_area_code',
> '$business_fax', '$user_name', '$userpass') ");
>
> if(!$db->query($sql))
> {
> echo "<b>New member has NOT been added:</b> ", $db->Error;
> exit;
> }
> else
> print "User <b>$user_name</b> from <b>$company_name</b> has been
> added !";
> page_close();
> ?>
>
> The "sess" name "Valid_Session" has been defined in local.inc as follows:
> ...
> class DB_Valid extends DB_Sql {
> var $Host = "localhost";
> var $Database = "phplib";
> var $User = "root";
> var $Password = "23646";
> }
> ...
> class Valid_CT_Sql extends CT_Sql {
> var $database_class = "DB_Valid"; ## Which database to connect...
> var $database_table = "active_sessions"; ## and find our session data in
> this table.
> }
> ...
> class Valid_Session extends Session {
> var $classname = "Valid_Session";
>
> var $cookiename = ""; ## defaults to classname
> var $magic = "Hocuspocus"; ## ID seed
> var $mode = "cookie"; ## We propagate session IDs with
> cookies
> var $fallback_mode = "get";
> var $lifetime = 0; ## 0 = do session cookies, else
> minutes
> var $that_class = "Valid_CT_Sql"; ## name of data storage container
> var $gc_probability = 5;
> }
> ...
>
> I have also declared a DB_Members class from DB_Sql since it is so
> convenient to use.
> ...
> class DB_Members extends DB_Sql {
> var $Host = "localhost";
> var $Database = "valid3";
> var $User = "root";
> var $Password = "23646";
> }
> ...
> PLEASE NOTE THAT THIS IS A DIFFERENT DATABASE !!
>
> When the above page executes, the new record is properly "inserted" into DB:
> valid3. However, I get this error msg when the page_close() is called at the
> end.
>
> Database error: Invalid SQL: update active_sessions set
> val='VmFsaWRfU2Vzc2lvbjokdGhpcy0+aW4gPSAnJzsgJHRoaXMtPnB0ID0gYXJyYXkoKTsg',
> changed='20001019100117' where sid='1fc61324228a0cc35e27d8b73dba7502' and
> name='Valid_Session'
> MySQL Error: 1146 (Table 'valid3.active_sessions' doesn't exist)
>
> Apparently, it's trying to insert the session record into the
> active_sessions table in the valid3 DB. How do I explicit tell PHPLIB that
> the session is with DB_Valid and not DB_Members ?
>
> Thank you in advance for anyone who can help !!
>
> Lu Trinh
> trinhl <email protected>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: phplib-unsubscribe <email protected>
> For additional commands, e-mail: phplib-help <email protected>
---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>
- Next message: Matt Friedman: "[phplib] Help with set block in templates please."
- Previous message: TRINHL <email protected>: "[phplib] Some help please !!"
- In reply to: TRINHL <email protected>: "[phplib] Some help please !!"
- Next in thread: Michael Geißler: "AW: [phplib] Some help please !!"
- Reply: Michael Geißler: "AW: [phplib] Some help please !!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

