[PHP-DB] replication questions

2002-05-20 Thread Jeff Field

I think I understand how to set up replication but have a couple unanswered
questions. I'm hoping the list can help.

I have two servers with MySQL.  Each server currently has completely
different databases, except for the standard mysql permissions database.
Server 1 is in production and server 2 is basically a development box.  I
would like to replicate server 1's databases to server 2 (in effect,
creating a hot-swap), but then that would mean that server 2 not only has
the production db's, but also the development db's.  My  question are:

1) Is that even possible to do?  Can a slave to a master also have
additional db's on it that the master doesn't even know about?

2) If the answer to question one is yes, then what do you do regarding the
mysql permissions db on the slave?

BTW, I'm thinking that my setup perhaps has to be more along the following
lines:

The master contains all my db's, both production and development.  The
production db's (as well as the development db's) would sit there in
production on server 1, replicating all the data to server 2.  I would have
to set the permissions for both production and development db's on server 1.

Meanwhile, as the production server is sitting there and replicating all
it's important data to the development box, I could still work on the
development db's on the slave box (thereby not fooling around with the
production box).

The issue, as I see it, would be that the slave box's development db's would
soon go out of synch with the development db's on the master (because I'd be
inserting, updating, etc. records on the development db's on the slave and
the master would never know).  I could set up two-way replication, but since
I don't really care about the development db's being in synch on the master,
why bother.  Does this make sense?

Anyway, I hope I've made this clear enough for someone to jump with answers
and comments.

Jeff


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Weird intermittent "No Database Selected" problem

2002-06-06 Thread Jeff Field

Help!

I've been having a weird problem today (and maybe it's been there all along,
just haven't noticed...it's only been live a few days).  I have a web page
that allows users to query my database by either subject or alphabet (A-Z).
Today (and I think I noticed it once before but didn't pay much attention),
if you do a query, the first time it comes back with the results.  The
second time, clicking the same letter (or sometimes other letters), for
instance, it comes back with a "Database Not Selected" error.  Or, every
time in a row for a dozen times it comes back with a "Database Not Selected"
error.  Or, sometimes it comes back with the results just fine for twenty
times in a row. Or, ...

You get the idea.  It doesn't happen all the time, just sometimes, and in no
particular order.  Very strange because I'm not changing a dang thing.
Anyway, I've already tried rebooting the server, no change.  And, I've tried
accessing the web page from other machines, same problem.  Has anyone ever
run into this?

I'm running Red Hat 7.2, Apache 1.3.23, MySQL 3.23.49a, and PHP 4.2.1.

Here's the code in the web page with only some name changes (for security,
ya know):



And then the code in my include where I keep all the db connection stuff:



Any help is appreciated!!  Thanks!

Jeff


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] RE: [PHP] Weird intermittent "No Database Selected" problem

2002-06-06 Thread Jeff Field

Thanks for the help, all!  Here was the problem...I think, I'm pretty sure,
eh?

In mysql_select_db($database_mydb, $mydb), I have the variable,
"$database_mydb", which is actually something that Macromedia's Dreamweaver
MX created (for those that don't know it, Dreamweaver MX supports a little
PHP).

Well, not to put the blame on Macromedia, it was all my fault and I now feel
a bit stupid, I think it all boiled down to "$database_mydb" not being
declared global in the function I wrote to do the query.

Funny that it worked probably 95% of the time.  Must have been due to
mysql_pconnect or something holding open previous connections to the db and
the script just connecting to the last connected db.  Anyway...

Sorry for the trouble!

Jeff

> -Original Message-
> From: hugh danaher [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, June 06, 2002 5:37 PM
> To: [EMAIL PROTECTED]
> Cc: php
> Subject: Re: [PHP] Weird intermittent "No Database Selected" problem
>
>
> Are all the variables needed for the function getting into your
> call_user_func()?  Also, perhaps some aren't set or are being
> unset outside
> your function--say, you are opening a new page and not passing all the
> variables to it.  The function (which apparently works) isn't getting set
> variables.  Try echoing the input variables just above the
> function call and
> see if they're all there.
> Hope this helps,
> Hugh
>
> - Original Message -
> From: "Jeff Field" <[EMAIL PROTECTED]>
> To: "Php-General (E-mail)" <[EMAIL PROTECTED]>
> Sent: Thursday, June 06, 2002 2:34 PM
> Subject: RE: [PHP] Weird intermittent "No Database Selected" problem
>
>
> > Hmmm...not sure how to check the status of the db function calls (sorry,
> I'm
> > relatively new to PHP, help on this is appreciated), but I did add the
> > following to the script:
> >
> > echo "Error " . mysql_errno ( ). ": " . mysql_error ( );
> >
> > It prints out "Error 0:" when the script runs just fine, but
> nothing when
> > the page comes back with "No Database Selected".
> >
> > Any thoughts?  Thanks!
> >
> > Jeff
> >
> > > -Original Message-
> > > From: Scott Hurring [mailto:[EMAIL PROTECTED]]
> > > Sent: Thursday, June 06, 2002 4:15 PM
> > > To: Php-General (E-mail)
> > > Subject: RE: [PHP] Weird intermittent "No Database Selected" problem
> > >
> > >
> > > I assume you're not checking the status returned by the
> > > database function calls, becuase they'd probably give
> > > you valueable information on *why* it's doing that.  :)
> > >
> > > try checking the return val, and (if using mysql) print
> > > out mysql_error() if you get a bad return val.
> > >
> > > ---
> > > Scott Hurring
> > > Systems Programmer
> > > EAC Corporation
> > > [EMAIL PROTECTED]
> > > Voice: 201-462-2149
> > > Fax: 201-288-1515
> > >
> > > > -Original Message-
> > > > From: Jeff Field [mailto:[EMAIL PROTECTED]]
> > > > Sent: Thursday, June 06, 2002 4:58 PM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: [PHP] Weird intermittent "No Database Selected" problem
> > > >
> > > >
> > > > I apologize...I just posted this to the database list but
> > > > then realized it
> > > > may not be a database issue, so thought I'd better give it a
> > > > shot over here.
> > > >
> > > > Help!
> > > >
> > > > I've been having a weird problem today (and maybe it's been
> > > > there all along,
> > > > just haven't noticed...it's only been live a few days).  I
> > > > have a web page
> > > > that allows users to query my database by either subject or
> > > > alphabet (A-Z).
> > > > Today (and I think I noticed it once before but didn't pay
> > > > much attention),
> > > > if you do a query, the first time it comes back with the
> results.  The
> > > > second time, clicking the same letter (or sometimes other
> > > > letters), for
> > > > instance, it comes back with a "Database Not Selected" error.
> > > >  Or, every
> > > > time in a row for a dozen times it comes back with a
> > > > "Database Not Selected"
> > > > error.  Or, sometimes it comes back with the results