RE: [PHP-DB] Session variables and arrays

2002-10-29 Thread Ryan Neudorf
Ok. The categories are coming from checkboxes, e.g.:
Accountant

Which then are handled by a $cgi class dealy and handed to the
$_SESSION['categories'] variable before being forwarded to the next
step. I was thinking that the problem might be with the $cgi object, but
when I print_r($_SESSION['categories']) it shows the contents of the
array.

Anyways, I did the print ":::{$_SESSION['categories']}:::"; and got 
:::Array:::

Hmph

- Ryan

> -Original Message-
> From: Peter Beckman [mailto:beckman@;purplecow.com] 
> Sent: Tuesday, October 29, 2002 9:59 PM
> To: Ryan Neudorf
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] Session variables and arrays
> 
> 
> Well, can't say I see the same problem:
> 
>  $_SESSION['foo'] = array("hi"=>"bye");
> 
> print_r($_SESSION['foo']);
> echo "\n\n";
> print is_array($_SESSION['foo']);
> 
> Outputs:
> X-Powered-By: PHP/4.2.2
> Content-type: text/html
> 
> Array
> (
> [hi] => bye
> )
> 1
> 
> Which is what I'd expect it to show.
> 
> Now how did you assign categories?
> 
> Maybe the var is a scalar and is actually "Array (\n  [0] => 
> '1';\n  [1] => '12';" and you are confused.o
> 
> If you are saying:
> 
> $_SESSION['categories'] = "Array (
> [0] = '1';
> ";
> 
> Then it IS a scalar.  Try this:
> 
> print ":::{$_SESSION['categories']}:::";
> 
> If you get this:
> 
> :::Array:::
> 
> Then I have no clue what the problem is
> 
> If you don't get that, then we know what your problem is.
> 
> Peter
> 
> On Tue, 29 Oct 2002, Ryan Neudorf wrote:
> 
> > I'm having a problem with session variables and arrays.
> > I'm building a multi step sign up form and I need to store all the 
> > variable until the final step, when they are inputed to a 
> database. I 
> > thought the best way to do this would be to store the contents for 
> > $HTTP_POST_VARS in session variables. This works fine for 
> everything 
> > except for my array of checkboxes.
> >
> > When I do a print_r($_SESSION) it displays the following for the 
> > sessionvariable assigned to the checkboxes: [categories] => Array (
> > [0] => '1';
> > [1] => '12';
> > ... Etc ...
> >
> > But when I run any sort of array function (is_array, foreach) on 
> > $_SESSION['categories'] it appears that it is a scalar, not 
> an array.
> >
> > Any ideas?
> >
> > - Ryan
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> 
> --
> -
> Peter BeckmanSystems Engineer, Fairfax Cable 
> Access Corporation
> [EMAIL PROTECTED] 
> http://www.purplecow.com/
> 
> --
> -
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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




Re: [PHP-DB] Decimal places.

2002-10-29 Thread Peter Beckman
printf("%d",($eall - $sall) / 1000);

On Wed, 30 Oct 2002, Andrew Wilson wrote:

> Hay guys,
> I have two variables ( integers ) that are being minused one from the other
> and i am printing the result to the screen but i am getting unwanted
> decimals.
>
> print ($eall - $sall) / 1000;
>
> My question is what is the easiest way to strip decimals off the above
> result. The only way i know around it is if i piped the above statement into
> another varible and set that variable to an integer then printed that.
>
> I dont really want to do this as i will end up with 50 extra variables.
> Thanks in advance for your comments.
>
> Andrew Wilson
> Technical Support
> Netway Networks
> 8920-8877
>
>
>
>
> Netway Networks Pty Ltd
> (T) 8920 8877
> (F) 8920 8866
>
>
>

---
Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation
[EMAIL PROTECTED] http://www.purplecow.com/
---


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




[PHP-DB] Decimal places.

2002-10-29 Thread Andrew Wilson
Hay guys, 
I have two variables ( integers ) that are being minused one from the other
and i am printing the result to the screen but i am getting unwanted
decimals.
 
print ($eall - $sall) / 1000;

My question is what is the easiest way to strip decimals off the above
result. The only way i know around it is if i piped the above statement into
another varible and set that variable to an integer then printed that. 

I dont really want to do this as i will end up with 50 extra variables.
Thanks in advance for your comments. 

Andrew Wilson 
Technical Support 
Netway Networks 
8920-8877 

 


Netway Networks Pty Ltd 
(T) 8920 8877 
(F) 8920 8866 





Re: [PHP-DB] Re: losing my session variables

2002-10-29 Thread Peter Beckman
prepend.php gets called before running any page on a site.  Put the
"session_start()" in the prepend.php and you won't have to worry where you
put it.

Learn more about it on the php web site (don't have the url handy).

Peter

On Tue, 29 Oct 2002, Seabird wrote:

> turns out, I already have a session_start(). I have some seperate files and
> use them as includes. The thing is... my login form is located on my
> "index.php" and if I do a login, only this file will recognize my session
> variables.
>
> I load pages external into a layer, but none of them get the session
> variables. I'll upload some files so you can see. I'll post this.
>
> Thanx already,
> Jacco
> --
> http://seabird.jmtech.ca
>
> Attitude is Everything!
> But Remember, Attitudes are Contagious!
> Is Yours worth Catching
> "Baroiller Pierre-Emmanuel" <[EMAIL PROTECTED]> wrote in message
> news:20021030002059.9083.qmail@;pb1.pair.com...
> > You only need to add session_start() in your script before storing your
> data
> > into the $_SESSION array.
> > Without session_start(), no session is started by php...
> >
> > Regards,
> > P.E. Baroiller
> >
> > "Seabird" <[EMAIL PROTECTED]> a écrit dans le message de news:
> > [EMAIL PROTECTED]
> > > Hi everyone,
> > >
> > > I use a login-script, but for some reason I keep losing my $_SESSION
> > > variables. Can Anyone tell me why?
> > >
> > > Here's my login script:
> > >
> > >  > > if(isset($_POST['submit'])) { // if form has been submitted
> > >  /* check they filled in what they were supposed to and authenticate */
> > >  if(!$_POST['uname'] | !$_POST['passwd']) {
> > >   print '
> > > 
> > >> > maxlength="8">
> > >> > name="passwd">
> > >   
> > >   
> > >   please fill in the required
> > > fields.
> > >   
> > > ';
> > >  }
> > >  // authenticate.
> > >  if(!get_magic_quotes_gpc()) {
> > >   $_POST['uname'] = addslashes($_POST['uname']);
> > >  }
> > >  $check = $db_object->query("SELECT username, password FROM users WHERE
> > > username = '".$_POST['uname']."'");
> > >  if(DB::isError($check)) {
> > >   print '
> > > 
> > >> > maxlength="8">
> > >> > name="passwd">
> > >   
> > >   
> > >   username doesn\'t exist.  > > class="header"
> > > href="javascript:loadPage(\'mainlayer\',null,\'login/signup.php\')">sign
> > up
> > > here
> > >   
> > > ';
> > >  }
> > >  $info = $check->fetchRow();
> > >  // check passwords match
> > >  $_POST['passwd'] = stripslashes($_POST['passwd']);
> > >  $info['password'] = stripslashes($info['password']);
> > >  $_POST['passwd'] = md5($_POST['passwd']);
> > >  if($_POST['passwd'] != $info['password']) {
> > >   print '
> > > 
> > >> > maxlength="8">
> > >> > name="passwd">
> > >   
> > >   
> > >   wrong password, try again
> > >   
> > > ';
> > >  }
> > >
> > >  // if we get here username and password are correct, register session
> > > variables and set
> > >  // last login time.
> > >  $date = date('m d, Y');
> > >  $update_login = $db_object->query("UPDATE users SET last_login =
> '$date'
> > > WHERE username = '".$_POST['uname']."'");
> > >  $_POST['uname'] = stripslashes($_POST['uname']);
> > >  $_SESSION['username'] = $_POST['uname'];
> > >  $_SESSION['password'] = $_POST['passwd'];
> > >  $db_object->disconnect();
> > > ?>
> > > Welcome  > >
> >
> href="javascript:loadPage('mainlayer',null,'users/edit.php?user= > > ['username']?>')"> > > color="white"> > > href="login/logout.php">Logout
> > > 
> > >  > > }
> > > else { // if form hasn't been submitted
> > > ?>
> > > 
> > > 
> > >> > maxlength="8">
> > >> > name="passwd">
> > >   
> > >   
> > >> > href="javascript:loadPage('mainlayer',null,'login/signup.php')">sign up
> > > here 
> > >   
> > >  > > }
> > > ?>
> > >
> > > --
> > > http://seabird.jmtech.ca
> > >
> > > Attitude is Everything!
> > > But Remember, Attitudes are Contagious!
> > > Is Yours worth Catching
> > >
> > >
> >
> >
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

---
Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation
[EMAIL PROTECTED] http://www.purplecow.com/
---


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




Re: [PHP-DB] losing my session variables

2002-10-29 Thread Peter Beckman
Put "session_start()" somewhere in your code.

$_SESSION isn't set until you "start" your session.

And don't set session variables by $_SESSION[foo] = bar;

DO this:

$foo = bar;
session_register("foo");

Much better.

However, if anyone can correct me, go for it.  I just believe that setting
global variables that the system controls and writes is a bad idea unless
you use the functions that you should.

Get out of the habit of SETTING variables using $_POST or $_SESSION or
$GLOBALS.  DO get in the habit of setting globals by just setting your
variables correctly in the right scope.

Peter

On Tue, 29 Oct 2002, Seabird wrote:

> Hi everyone,
>
> I use a login-script, but for some reason I keep losing my $_SESSION
> variables. Can Anyone tell me why?
>
> Here's my login script:
>
>  if(isset($_POST['submit'])) { // if form has been submitted
>  /* check they filled in what they were supposed to and authenticate */
>  if(!$_POST['uname'] | !$_POST['passwd']) {
>   print '
> 
>maxlength="8">
>name="passwd">
>   
>   
>   please fill in the required
> fields.
>   
> ';
>  }
>  // authenticate.
>  if(!get_magic_quotes_gpc()) {
>   $_POST['uname'] = addslashes($_POST['uname']);
>  }
>  $check = $db_object->query("SELECT username, password FROM users WHERE
> username = '".$_POST['uname']."'");
>  if(DB::isError($check)) {
>   print '
> 
>maxlength="8">
>name="passwd">
>   
>   
>   username doesn\'t exist.  class="header"
> href="javascript:loadPage(\'mainlayer\',null,\'login/signup.php\')">sign up
> here
>   
> ';
>  }
>  $info = $check->fetchRow();
>  // check passwords match
>  $_POST['passwd'] = stripslashes($_POST['passwd']);
>  $info['password'] = stripslashes($info['password']);
>  $_POST['passwd'] = md5($_POST['passwd']);
>  if($_POST['passwd'] != $info['password']) {
>   print '
> 
>maxlength="8">
>name="passwd">
>   
>   
>   wrong password, try again
>   
> ';
>  }
>
>  // if we get here username and password are correct, register session
> variables and set
>  // last login time.
>  $date = date('m d, Y');
>  $update_login = $db_object->query("UPDATE users SET last_login = '$date'
> WHERE username = '".$_POST['uname']."'");
>  $_POST['uname'] = stripslashes($_POST['uname']);
>  $_SESSION['username'] = $_POST['uname'];
>  $_SESSION['password'] = $_POST['passwd'];
>  $db_object->disconnect();
> ?>
> Welcome  href="javascript:loadPage('mainlayer',null,'users/edit.php?user= ['username']?>')"> color="white"> href="login/logout.php">Logout
> 
>  }
> else { // if form hasn't been submitted
> ?>
> 
> 
>maxlength="8">
>name="passwd">
>   
>   
>href="javascript:loadPage('mainlayer',null,'login/signup.php')">sign up
> here 
>   
>  }
> ?>
>
> --
> http://seabird.jmtech.ca
>
> Attitude is Everything!
> But Remember, Attitudes are Contagious!
> Is Yours worth Catching
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

---
Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation
[EMAIL PROTECTED] http://www.purplecow.com/
---


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




Re: [PHP-DB] Session variables and arrays

2002-10-29 Thread Peter Beckman
Well, can't say I see the same problem:

"bye");

print_r($_SESSION['foo']);
echo "\n\n";
print is_array($_SESSION['foo']);

Outputs:
X-Powered-By: PHP/4.2.2
Content-type: text/html

Array
(
[hi] => bye
)
1

Which is what I'd expect it to show.

Now how did you assign categories?

Maybe the var is a scalar and is actually "Array (\n  [0] => '1';\n  [1] =>
'12';" and you are confused.o

If you are saying:

$_SESSION['categories'] = "Array (
[0] = '1';
";

Then it IS a scalar.  Try this:

print ":::{$_SESSION['categories']}:::";

If you get this:

:::Array:::

Then I have no clue what the problem is

If you don't get that, then we know what your problem is.

Peter

On Tue, 29 Oct 2002, Ryan Neudorf wrote:

> I'm having a problem with session variables and arrays.
> I'm building a multi step sign up form and I need to store all the
> variable until the final step, when they are inputed to a database. I
> thought the best way to do this would be to store the contents for
> $HTTP_POST_VARS in session variables. This works fine for everything
> except for my array of checkboxes.
>
> When I do a print_r($_SESSION) it displays the following for the
> sessionvariable assigned to the checkboxes:
> [categories] => Array (
>   [0] => '1';
>   [1] => '12';
> ... Etc ...
>
> But when I run any sort of array function (is_array, foreach) on
> $_SESSION['categories'] it appears that it is a scalar, not an array.
>
> Any ideas?
>
> - Ryan
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

---
Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation
[EMAIL PROTECTED] http://www.purplecow.com/
---


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




[PHP-DB] Archiving A Database

2002-10-29 Thread Josh Johnson
Does anyone know of speedy methods of periodically archiving and
retrieving a database table? I've got a table I'm using to log
statistical data, and it's getting 10k+ entries per day. Entries are
only logged in the database if the user is authenticated for access, and
only once per access session (the user is authenticated, a cookie is
set, and the entry is logged. From that point the user is authenticated
by verifying the cookie, which expires when the user's browser closes)

The data is critical (used for billing and such), but the log viewing
script I've written runs slower and slower with each passing day, and at
one point the entire table was corrupted due to neglect on our system
admin's part (I warned them about the default setting of
mysql_max_connections being too low for a site that relied on the DB so
heavily and had so much traffic.). The script is a simple front end to
several MySQL queries, that retrieve totals for the past hour, day,
week, month and grand totals for all clients or a given client. The rest
of the site has been unaffected by the log issues.

My current approach is to log the data as XML, one record per file, and
create a log file that is an index of refrences to each record. I then
empty previous data n the database. This works, but is very hard/slow to
retrieve specific groups of information, and dumping the database takes
a long time as well, which adds the difficulty of ensuring no records
are lost. I also haven't yet tackled the issue of combining data from
the XML seamlessly with live data from the database.

I'm opening the floor to other potential solutions, or war stories from
anyone else who's been in this situation before. If there's another
approach aside from writing individual flat files, please let me know. I
haven't tested it yet, but I think maybe logging all entries/data for a
given log period into one file would speed things up, but I worry about
the 40 megabyte files that could be potentially created. I'm also open
to complete alternatives, since the main use for this data is to
generate total accesses per a given factor (client, ip, referrer, etc). 

Any help is greatly appreciated. I can give any information needed, just
ask!

Thanks, 
-- Josh

P.S. I did suggest that this issue be tackled when I first installed the
system that creates the log, but management didn't think it was worth
bothering with at the time. 

P.P.S. I did look through the archives before I posted, and didn't find
anything. Please flame in private if I missed something!



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




RE: [PHP-DB] exporting to xml

2002-10-29 Thread Beau Lebens
you don't see them because they are interpreted as HTML tags, they are
unknown, so they are ignored.

options;

1. View -> Source

2. Encode all "<" as < (HTML version) and it will display it all
   as text, then you can copy-paste it to somewhere else

3. Wrap it all in a  tag, then follow 2.

4. Output the proper XML declaration at the top of the file so that
   IE treats it like XML, and does it's fancy dynamic-tree style
   presentation.

   

   ^--- a very basic XML declaration

HTH

Beau

// -Original Message-
// From: Martin Hudec [mailto:corwin@;corwin.sk]
// Sent: Wednesday, 30 October 2002 12:00 AM
// To: [EMAIL PROTECTED]
// Subject: [PHP-DB] exporting to xml
// 
// 
// Hello,
// 
//   i am creating script which will make select and desc to table and
//   then based on results it will make xml file...all is okay, 
// but on my
//   IE it takes it as xml file (it is okay) BUT on my screen I dont see
//   any of  tags...how can i override that?
// 
//   script is here:
// 
// header("Content-type: text/xml");
// 
// db related stuff...
// 
// $fcount = mysql_num_fields($result);
// 
// print ""; //will be table name
// 
// while($row = mysql_fetch_array($result)){
// print "";
// for($i=0; $i<$fcount; $i++){
// $tag = mysql_field_name($result,$i);
// print "<$tag>". $row[$i]. "";
// }
// print "";
// }
// 
// -- 
// Best regards,
//  Martin  mailto:corwin@;corwin.sk
// 
// 
// -- 
// PHP Database Mailing List (http://www.php.net/)
// To unsubscribe, visit: http://www.php.net/unsub.php
// 

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




[PHP-DB] Re: losing my session variables

2002-10-29 Thread Seabird
turns out, I already have a session_start(). I have some seperate files and
use them as includes. The thing is... my login form is located on my
"index.php" and if I do a login, only this file will recognize my session
variables.

I load pages external into a layer, but none of them get the session
variables. I'll upload some files so you can see. I'll post this.

Thanx already,
Jacco
--
http://seabird.jmtech.ca

Attitude is Everything!
But Remember, Attitudes are Contagious!
Is Yours worth Catching
"Baroiller Pierre-Emmanuel" <[EMAIL PROTECTED]> wrote in message
news:20021030002059.9083.qmail@;pb1.pair.com...
> You only need to add session_start() in your script before storing your
data
> into the $_SESSION array.
> Without session_start(), no session is started by php...
>
> Regards,
> P.E. Baroiller
>
> "Seabird" <[EMAIL PROTECTED]> a écrit dans le message de news:
> [EMAIL PROTECTED]
> > Hi everyone,
> >
> > I use a login-script, but for some reason I keep losing my $_SESSION
> > variables. Can Anyone tell me why?
> >
> > Here's my login script:
> >
> >  > if(isset($_POST['submit'])) { // if form has been submitted
> >  /* check they filled in what they were supposed to and authenticate */
> >  if(!$_POST['uname'] | !$_POST['passwd']) {
> >   print '
> > 
> >> maxlength="8">
> >> name="passwd">
> >   
> >   
> >   please fill in the required
> > fields.
> >   
> > ';
> >  }
> >  // authenticate.
> >  if(!get_magic_quotes_gpc()) {
> >   $_POST['uname'] = addslashes($_POST['uname']);
> >  }
> >  $check = $db_object->query("SELECT username, password FROM users WHERE
> > username = '".$_POST['uname']."'");
> >  if(DB::isError($check)) {
> >   print '
> > 
> >> maxlength="8">
> >> name="passwd">
> >   
> >   
> >   username doesn\'t exist.  > class="header"
> > href="javascript:loadPage(\'mainlayer\',null,\'login/signup.php\')">sign
> up
> > here
> >   
> > ';
> >  }
> >  $info = $check->fetchRow();
> >  // check passwords match
> >  $_POST['passwd'] = stripslashes($_POST['passwd']);
> >  $info['password'] = stripslashes($info['password']);
> >  $_POST['passwd'] = md5($_POST['passwd']);
> >  if($_POST['passwd'] != $info['password']) {
> >   print '
> > 
> >> maxlength="8">
> >> name="passwd">
> >   
> >   
> >   wrong password, try again
> >   
> > ';
> >  }
> >
> >  // if we get here username and password are correct, register session
> > variables and set
> >  // last login time.
> >  $date = date('m d, Y');
> >  $update_login = $db_object->query("UPDATE users SET last_login =
'$date'
> > WHERE username = '".$_POST['uname']."'");
> >  $_POST['uname'] = stripslashes($_POST['uname']);
> >  $_SESSION['username'] = $_POST['uname'];
> >  $_SESSION['password'] = $_POST['passwd'];
> >  $db_object->disconnect();
> > ?>
> > Welcome  >
>
href="javascript:loadPage('mainlayer',null,'users/edit.php?user= > ['username']?>')"> > color="white"> > href="login/logout.php">Logout
> > 
> >  > }
> > else { // if form hasn't been submitted
> > ?>
> > 
> > 
> >> maxlength="8">
> >> name="passwd">
> >   
> >   
> >> href="javascript:loadPage('mainlayer',null,'login/signup.php')">sign up
> > here 
> >   
> >  > }
> > ?>
> >
> > --
> > http://seabird.jmtech.ca
> >
> > Attitude is Everything!
> > But Remember, Attitudes are Contagious!
> > Is Yours worth Catching
> >
> >
>
>



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




[PHP-DB] Re: losing my session variables

2002-10-29 Thread Seabird
where do I place a session start in a script? before the form? after?
inside?
Jacco
--
http://seabird.jmtech.ca

Attitude is Everything!
But Remember, Attitudes are Contagious!
Is Yours worth Catching
"Baroiller Pierre-Emmanuel" <[EMAIL PROTECTED]> wrote in message
news:20021030002059.9083.qmail@;pb1.pair.com...
> You only need to add session_start() in your script before storing your
data
> into the $_SESSION array.
> Without session_start(), no session is started by php...
>
> Regards,
> P.E. Baroiller
>
> "Seabird" <[EMAIL PROTECTED]> a écrit dans le message de news:
> [EMAIL PROTECTED]
> > Hi everyone,
> >
> > I use a login-script, but for some reason I keep losing my $_SESSION
> > variables. Can Anyone tell me why?
> >
> > Here's my login script:
> >
> >  > if(isset($_POST['submit'])) { // if form has been submitted
> >  /* check they filled in what they were supposed to and authenticate */
> >  if(!$_POST['uname'] | !$_POST['passwd']) {
> >   print '
> > 
> >> maxlength="8">
> >> name="passwd">
> >   
> >   
> >   please fill in the required
> > fields.
> >   
> > ';
> >  }
> >  // authenticate.
> >  if(!get_magic_quotes_gpc()) {
> >   $_POST['uname'] = addslashes($_POST['uname']);
> >  }
> >  $check = $db_object->query("SELECT username, password FROM users WHERE
> > username = '".$_POST['uname']."'");
> >  if(DB::isError($check)) {
> >   print '
> > 
> >> maxlength="8">
> >> name="passwd">
> >   
> >   
> >   username doesn\'t exist.  > class="header"
> > href="javascript:loadPage(\'mainlayer\',null,\'login/signup.php\')">sign
> up
> > here
> >   
> > ';
> >  }
> >  $info = $check->fetchRow();
> >  // check passwords match
> >  $_POST['passwd'] = stripslashes($_POST['passwd']);
> >  $info['password'] = stripslashes($info['password']);
> >  $_POST['passwd'] = md5($_POST['passwd']);
> >  if($_POST['passwd'] != $info['password']) {
> >   print '
> > 
> >> maxlength="8">
> >> name="passwd">
> >   
> >   
> >   wrong password, try again
> >   
> > ';
> >  }
> >
> >  // if we get here username and password are correct, register session
> > variables and set
> >  // last login time.
> >  $date = date('m d, Y');
> >  $update_login = $db_object->query("UPDATE users SET last_login =
'$date'
> > WHERE username = '".$_POST['uname']."'");
> >  $_POST['uname'] = stripslashes($_POST['uname']);
> >  $_SESSION['username'] = $_POST['uname'];
> >  $_SESSION['password'] = $_POST['passwd'];
> >  $db_object->disconnect();
> > ?>
> > Welcome  >
>
href="javascript:loadPage('mainlayer',null,'users/edit.php?user= > ['username']?>')"> > color="white"> > href="login/logout.php">Logout
> > 
> >  > }
> > else { // if form hasn't been submitted
> > ?>
> > 
> > 
> >> maxlength="8">
> >> name="passwd">
> >   
> >   
> >> href="javascript:loadPage('mainlayer',null,'login/signup.php')">sign up
> > here 
> >   
> >  > }
> > ?>
> >
> > --
> > http://seabird.jmtech.ca
> >
> > Attitude is Everything!
> > But Remember, Attitudes are Contagious!
> > Is Yours worth Catching
> >
> >
>
>



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




[PHP-DB] Re: losing my session variables

2002-10-29 Thread BAROILLER Pierre-Emmanuel
You only need to add session_start() in your script before storing your data
into the $_SESSION array.
Without session_start(), no session is started by php...

Regards,
P.E. Baroiller

"Seabird" <[EMAIL PROTECTED]> a écrit dans le message de news:
[EMAIL PROTECTED]
> Hi everyone,
>
> I use a login-script, but for some reason I keep losing my $_SESSION
> variables. Can Anyone tell me why?
>
> Here's my login script:
>
>  if(isset($_POST['submit'])) { // if form has been submitted
>  /* check they filled in what they were supposed to and authenticate */
>  if(!$_POST['uname'] | !$_POST['passwd']) {
>   print '
> 
>maxlength="8">
>name="passwd">
>   
>   
>   please fill in the required
> fields.
>   
> ';
>  }
>  // authenticate.
>  if(!get_magic_quotes_gpc()) {
>   $_POST['uname'] = addslashes($_POST['uname']);
>  }
>  $check = $db_object->query("SELECT username, password FROM users WHERE
> username = '".$_POST['uname']."'");
>  if(DB::isError($check)) {
>   print '
> 
>maxlength="8">
>name="passwd">
>   
>   
>   username doesn\'t exist.  class="header"
> href="javascript:loadPage(\'mainlayer\',null,\'login/signup.php\')">sign
up
> here
>   
> ';
>  }
>  $info = $check->fetchRow();
>  // check passwords match
>  $_POST['passwd'] = stripslashes($_POST['passwd']);
>  $info['password'] = stripslashes($info['password']);
>  $_POST['passwd'] = md5($_POST['passwd']);
>  if($_POST['passwd'] != $info['password']) {
>   print '
> 
>maxlength="8">
>name="passwd">
>   
>   
>   wrong password, try again
>   
> ';
>  }
>
>  // if we get here username and password are correct, register session
> variables and set
>  // last login time.
>  $date = date('m d, Y');
>  $update_login = $db_object->query("UPDATE users SET last_login = '$date'
> WHERE username = '".$_POST['uname']."'");
>  $_POST['uname'] = stripslashes($_POST['uname']);
>  $_SESSION['username'] = $_POST['uname'];
>  $_SESSION['password'] = $_POST['passwd'];
>  $db_object->disconnect();
> ?>
> Welcome 
href="javascript:loadPage('mainlayer',null,'users/edit.php?user= ['username']?>')"> color="white"> href="login/logout.php">Logout
> 
>  }
> else { // if form hasn't been submitted
> ?>
> 
> 
>maxlength="8">
>name="passwd">
>   
>   
>href="javascript:loadPage('mainlayer',null,'login/signup.php')">sign up
> here 
>   
>  }
> ?>
>
> --
> http://seabird.jmtech.ca
>
> Attitude is Everything!
> But Remember, Attitudes are Contagious!
> Is Yours worth Catching
>
>



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




[PHP-DB] losing my session variables

2002-10-29 Thread Seabird
Hi everyone,

I use a login-script, but for some reason I keep losing my $_SESSION
variables. Can Anyone tell me why?

Here's my login script:



  
  
  
  
  please fill in the required
fields.
  
';
 }
 // authenticate.
 if(!get_magic_quotes_gpc()) {
  $_POST['uname'] = addslashes($_POST['uname']);
 }
 $check = $db_object->query("SELECT username, password FROM users WHERE
username = '".$_POST['uname']."'");
 if(DB::isError($check)) {
  print '

  
  
  
  
  username doesn\'t exist. sign up
here
  
';
 }
 $info = $check->fetchRow();
 // check passwords match
 $_POST['passwd'] = stripslashes($_POST['passwd']);
 $info['password'] = stripslashes($info['password']);
 $_POST['passwd'] = md5($_POST['passwd']);
 if($_POST['passwd'] != $info['password']) {
  print '

  
  
  
  
  wrong password, try again
  
';
 }

 // if we get here username and password are correct, register session
variables and set
 // last login time.
 $date = date('m d, Y');
 $update_login = $db_object->query("UPDATE users SET last_login = '$date'
WHERE username = '".$_POST['uname']."'");
 $_POST['uname'] = stripslashes($_POST['uname']);
 $_SESSION['username'] = $_POST['uname'];
 $_SESSION['password'] = $_POST['passwd'];
 $db_object->disconnect();
?>
Welcome Logout




  
  
  
  
  sign up
here 
  


--
http://seabird.jmtech.ca

Attitude is Everything!
But Remember, Attitudes are Contagious!
Is Yours worth Catching



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




[PHP-DB] connections not closing

2002-10-29 Thread David Esposito
Hello all,

Platform:
Apache/1.3.20 (Unix)
Redhat 7.2
PHP/4.2.3
Postgres 7.2.1

Summary: periodically, something spazzes out and causes connections to the
database to stop closing at script termination; after a few seconds, the
number of connections to the database exceeds the connection limit for
postgres and all further connections to the database are denied ... the only
way to rectify the problem is to stop and restart apache

I use pgsql_connect (non-persistent connections) ... so that doesn't explain
it ...

I have the connection limit for postgres set at 64 ... and the Apache
MaxClients set to 150 ...

I cannot replicate this problem on production nor testing hardware ... It
happens very sporadically and without any real warning (it has happened
twice so far) ... Generally, it happens when the site is busy, but not
busier than what I've thrown at it with load test software ...

If and when this happens again, what further debugging information can i
gather to help diagnose this problem?

Thanks in advance,
Dave



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




[PHP-DB] Session variables and arrays

2002-10-29 Thread Ryan Neudorf
I'm having a problem with session variables and arrays.
I'm building a multi step sign up form and I need to store all the
variable until the final step, when they are inputed to a database. I
thought the best way to do this would be to store the contents for
$HTTP_POST_VARS in session variables. This works fine for everything
except for my array of checkboxes. 

When I do a print_r($_SESSION) it displays the following for the
sessionvariable assigned to the checkboxes:
[categories] => Array (
[0] => '1';
[1] => '12';
... Etc ...

But when I run any sort of array function (is_array, foreach) on
$_SESSION['categories'] it appears that it is a scalar, not an array.

Any ideas?

- Ryan


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




Re: [PHP-DB] Converting database from MS Access to MySQL on Linux

2002-10-29 Thread Steven Dowd
I think you would have to go a long way to beat DBTools  which i might add
is free

and will convert most all db formats msaccess/foxpro/excell/dbf/csv/txt  etc
etc to mysql
and also now supports PostgreSQL

http://www.dbtools.com.br


Steven


- Original Message -
From: "Michael Mauch" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, October 29, 2002 9:27 PM
Subject: Re: [PHP-DB] Converting database from MS Access to MySQL on Linux


> Matthew Hildebrand <[EMAIL PROTECTED]> wrote:
>
> > http://www.devhood.com/Tools/tool_details.aspx?tool_id=759
> > I've been very happy with this tool, and it is well worth the cost.
>
> If you are the author of the tool, you want perhaps add a note that "the
> tool" can convert _from_ Access _to_ MySQL on Linux - if it can do this.
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>



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




Re: [PHP-DB] Converting database from MS Access to MySQL on Linux

2002-10-29 Thread Michael Mauch
Matthew Hildebrand <[EMAIL PROTECTED]> wrote:

> http://www.devhood.com/Tools/tool_details.aspx?tool_id=759
> I've been very happy with this tool, and it is well worth the cost.

If you are the author of the tool, you want perhaps add a note that "the
tool" can convert _from_ Access _to_ MySQL on Linux - if it can do this.

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




[PHP-DB] Problems with ODBC connectivity

2002-10-29 Thread Bill Hudspeth
I have developed a PHP application that accesses a Microsoft Access database
through ODBC. The application works well using PHP version 4.1. I have
recently installed the newest version of PHP (4.2.3) on another machine
running NT4, and IIS 4.
Again, I am using an ODBC connection, and have given this connection the
same name, login, and password as is present in my PHP files. While the PHP
module is running fine, I cannot retrieve records from the database,
probably indicating a problem with my connectivity to the ODBC. Again, I
have made the same settings in the new ODBC entry as is present on the
development machine. Could there be a version problem with the PHP module?
Any other suggestions would be greatly appreciated.

Thanks, Bill



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




Re: [PHP-DB] new to cookies

2002-10-29 Thread Peter Beckman
First off, cookie documentation:

  http://www.php.net/manual/en/function.setcookie.php

Second, since you store your info in the DB, it might be easier and more
scalable to use a "$user" object which contains everything about the user:
userID, username, email, etc. for quick reference:

 $user = mysql_fetch_object($result);

 $user->id is now (ie) 37.
 $user->username is now Seabird
 $user->password is now superman

Now register the user variable to the session:

 session_start();  // will start the session unless it is already started somewhere 
else
 session_register("user"); // note, no dollar sign!

Now if you have register_globals on, $user will be defined globally.  If
not, $GLOBALS[user]->username or $_SESSION[user]->username will work.

Now go add a column to your user table called "login_cookie."  Do something
funky like
 $cookie_string = md5($user->username.$user->email.date("r"));
 $x = mysql_query("update user set login_cookie='{$cookie_string}' where 
id=$user->id");

Then
  $encID = rot13(base64_encode($user->id)).
  $cookie_contents = "$encID|$cookie_string";
  setcookie("MYcookie_string", $cookie_contents, 13); // fix that expire date 
to whatever you want, 3 days, 6 months

When the user comes to any page of the site:

  if (!empty($_COOKIE[MYcookie_string])) {
  list($encid, $str) = split("|",$_COOKIE[MYcookie_string]);
  $realid = rot13(base64_decode($encid));
  $x = mysql_query("select * from users where login_cookie='{$str}' and 
id={$realid}");
  if (mysql_num_rows($x) == 1) {
  $user = mysql_fetch_object($x);
  session_register("user");
  } else { // delete the cookie, it's bad
  setcookie("MYcookie_string","");
  }
  }

Now if their cookie string and their user ID matches what you have in the
DB, then you log them in via sessions.  If not, you do nothing.


Peter


On Tue, 29 Oct 2002, Seabird wrote:

> Hi everyone,
>
> I created a login on my page that handles with a session. I also would like
> to add a cookie so that people don't have to sign in every time they visit
> my page, but I have no clue how to create it. Is there anyone out there
> willing to help?
>
> my login script:
>
>  if(isset($_POST['submit'])) { // if form has been submitted
>  /* check they filled in what they were supposed to and authenticate */
>  if(!$_POST['uname'] | !$_POST['passwd']) {
>   print '
> 
>maxlength="8">
>name="passwd">
>   
>   
>   please fill in the required
> fields.
>   
> ';
>  }
>  // authenticate.
>  if(!get_magic_quotes_gpc()) {
>   $_POST['uname'] = addslashes($_POST['uname']);
>  }
>  $check = $db_object->query("SELECT username, password FROM users WHERE
> username = '".$_POST['uname']."'");
>  if(DB::isError($check)) {
>   print '
> 
>maxlength="8">
>name="passwd">
>   
>   
>   username doesn\'t exist.  class="header"
> href="javascript:loadPage(\'mainlayer\',null,\'login/signup.php\')">sign up
> here
>   
> ';
>  }
>  $info = $check->fetchRow();
>  // check passwords match
>  $_POST['passwd'] = stripslashes($_POST['passwd']);
>  $info['password'] = stripslashes($info['password']);
>  $_POST['passwd'] = md5($_POST['passwd']);
>  if($_POST['passwd'] != $info['password']) {
>   print '
> 
>maxlength="8">
>name="passwd">
>   
>   
>   wrong password, try again
>   
> ';
>  }
>
>  // if we get here username and password are correct, register session
> variables and set
>  // last login time.
>  $date = date('m d, Y');
>  $update_login = $db_object->query("UPDATE users SET last_login = '$date'
> WHERE username = '".$_POST['uname']."'");
>  $_POST['uname'] = stripslashes($_POST['uname']);
>  $_SESSION['username'] = $_POST['uname'];
>  $_SESSION['password'] = $_POST['passwd'];
>  $db_object->disconnect();
> ?>
> WelcomeYou are logged in as:
> 
> 
>  }
> else { // if form hasn't been submitted
> ?>
> 
> 
>maxlength="8">
>name="passwd">
>   
>   
>href="javascript:loadPage('mainlayer',null,'login/signup.php')">sign up
> here 
>   
>  }
> ?>
>
> I use a MySQL DB to store user-info.
> Jacco
>
> ps (if this is the wrong forum to ask this, then let me know and I'll post
> it elsewhere.
>
> --
> http://seabird.jmtech.ca
>
> Attitude is Everything!
> But Remember, Attitudes are Contagious!
> Is Yours worth Catching
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

---
Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation
[EMAIL PROTECTED] http://www.purplecow.com/
---


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

[PHP-DB] Agata Report: new version

2002-10-29 Thread Pablo Dall'Oglio
Univates, October, 22, 2002

I've just published the version 3 of Agata Report
=
http://agata.codigolivre.org.br

::: Agata Report is a Report Generator writen in PHP-GTK using Pear:DB.
::: further information at the end of message.

* Currently, Agata has support to English, Portuguese, Italian, French, German and 
Swedish;
* Agata connects to PostgreSQL, MySQL, Oracle, SyBase, MsSql, FrontBase, Informix 
and InterBase. But Agata was enough tested only with PostgreSQL, Informix, MsSql, 
InterBase, MySQL and DB2;

These new features have been developed since version 3 beta 001.

- theme support (skins) of gtk.themes.org;
- DBF import into SQL DataBase;
- Project manager;
- User's manual in english and portuguese;
- New SQL Statements;
- Prepared for DB2;
- Easy installation for Windows;

A new version 4.0 has been prepared with a lot of visual changes.

FURTHER INFORMATION
===

   Agata Report is a Report Generator, written in PHP-GTK. Allows you to edit and 
get SQL results from several Databases as Text or PostScript Files.

  It connects to database, lists its tables, fields and allows linking among 
tables, make constraints, orders, to apply functions and make queries. It generates 
results to PostScript or Text file.

  Agata Report has some usefull tools:

* Agata EIS is a graph generator tool. Allows user to define a couple of SQL 
instructions to get information from DataBase. These informations (numeric columns) 
will be drawed as lines, column or pizza graph. User can also export the data as CSV 
format, in order to use them in some spread sheet like gnumeric or kspread.
* Merge tool allows you to write any document (f.i. letter) and insert any 
variable from a SQL query into it. You may define SubQueries within the document, too. 
There are several symbols, lines and fonts you can use. Merge tool generates a 
PostScript file;
* Label tool is a (mini Merge Tool) that is usefull to generate address labels. 
You can define any format of label, inserting the fields wherever you like. The labels 
will be generated in a 2 columns A4 paper (PostScript File);
* Dia tool is a Diagram generator tool. Through this option you can generate a Diagram 
(DIA Format) with all the tables you are working on. Dia tool doesn't establish the 
lines among the tables in the Diagram yet.


Pablo Dall'Oglio
Univates IT team.
-- 
+--+
|   _Pablo Dall'Oglio ([EMAIL PROTECTED])  |
|  °v°   Univates - IT Department +55 51 3714-7040 |
| /(_)\  Life is a jorney, not a destination...|
|  ^ ^   Linux User n.223253, Lajeado, RS - Brasil |
+--+
: Programmer, pilot, wine taster and a half musician

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




RE: [PHP-DB] Column Defualts

2002-10-29 Thread Peter Beckman
This should be useful, mysql-wise:

http://www.mysql.com/documentation/mysql/bychapter/manual_MySQL_Optimisation.html#Data_size

Declare columns to be NOT NULL if possible. It makes everything faster
and you save one bit per column. Note that if you really need NULL in
your application you should definitely use it. Just avoid having it on
all columns by default.

Peter

On Tue, 29 Oct 2002, Peter Beckman wrote:

> With MySQL you save a bit by declaring a column not null.  If it is null,
> you are using a bit.  For performance on high volume and high transaction
> servers, declaring your columns not null will help, if only slightly.
>
> Peter
>
> On Tue, 29 Oct 2002, Ryan Jameson (USA) wrote:
>
> > No, I believe all databases have an isnull bit flag to go with any column
> > stored. So whether you set it or not the bit is being used.
> >
> > <>< Ryan
> >
> > -Original Message-
> > From: Gerard Samuel [mailto:gsam@;trini0.org]
> > Sent: Tuesday, October 29, 2002 9:47 AM
> > To: php-db
> > Subject: [PHP-DB] Column Defualts
> >
> >
> > Is defaulting a column to NULL considered as a waste of space??
> > I have a table that has 2 columns (so far) that defualt to NULL, and
> > potentially,
> > there can be good amount of rows with NULL.  Just wondering...
> >
> > --
> > Gerard Samuel
> > http://www.trini0.org:81/
> > http://dev.trini0.org:81/
> >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
> ---
> Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation
> [EMAIL PROTECTED] http://www.purplecow.com/
> ---
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

---
Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation
[EMAIL PROTECTED] http://www.purplecow.com/
---


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




RE: [PHP-DB] Column Defualts

2002-10-29 Thread Peter Beckman
With MySQL you save a bit by declaring a column not null.  If it is null,
you are using a bit.  For performance on high volume and high transaction
servers, declaring your columns not null will help, if only slightly.

Peter

On Tue, 29 Oct 2002, Ryan Jameson (USA) wrote:

> No, I believe all databases have an isnull bit flag to go with any column
> stored. So whether you set it or not the bit is being used.
>
> <>< Ryan
>
> -Original Message-
> From: Gerard Samuel [mailto:gsam@;trini0.org]
> Sent: Tuesday, October 29, 2002 9:47 AM
> To: php-db
> Subject: [PHP-DB] Column Defualts
>
>
> Is defaulting a column to NULL considered as a waste of space??
> I have a table that has 2 columns (so far) that defualt to NULL, and
> potentially,
> there can be good amount of rows with NULL.  Just wondering...
>
> --
> Gerard Samuel
> http://www.trini0.org:81/
> http://dev.trini0.org:81/
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

---
Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation
[EMAIL PROTECTED] http://www.purplecow.com/
---


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




RE: [PHP-DB] Column Defualts

2002-10-29 Thread Ryan Jameson (USA)
Also note that many databases calculate the maximum allowable rowsize and allocate 
that much space whether it's populated or not. This is especially evident when you use 
char types verses varchar types. It's actually a good thing in most cases that they 
do, since it allows query algorithms to be more efficient when jumping to the next row 
is always the same distance and forces records to be stored sequentially. I'd trade 
disk space for performance any day...

<>< Ryan

-Original Message-
From: Ryan Jameson (USA) 
Sent: Tuesday, October 29, 2002 10:30 AM
To: php-db
Subject: RE: [PHP-DB] Column Defualts


No, I believe all databases have an isnull bit flag to go with any column stored. So 
whether you set it or not the bit is being used.

<>< Ryan

-Original Message-
From: Gerard Samuel [mailto:gsam@;trini0.org]
Sent: Tuesday, October 29, 2002 9:47 AM
To: php-db
Subject: [PHP-DB] Column Defualts


Is defaulting a column to NULL considered as a waste of space??
I have a table that has 2 columns (so far) that defualt to NULL, and 
potentially,
there can be good amount of rows with NULL.  Just wondering...

-- 
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/



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


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


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




RE: [PHP-DB] Column Defualts

2002-10-29 Thread Ryan Jameson (USA)
No, I believe all databases have an isnull bit flag to go with any column stored. So 
whether you set it or not the bit is being used.

<>< Ryan

-Original Message-
From: Gerard Samuel [mailto:gsam@;trini0.org]
Sent: Tuesday, October 29, 2002 9:47 AM
To: php-db
Subject: [PHP-DB] Column Defualts


Is defaulting a column to NULL considered as a waste of space??
I have a table that has 2 columns (so far) that defualt to NULL, and 
potentially,
there can be good amount of rows with NULL.  Just wondering...

-- 
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/



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


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




[PHP-DB] Column Defualts

2002-10-29 Thread Gerard Samuel
Is defaulting a column to NULL considered as a waste of space??
I have a table that has 2 columns (so far) that defualt to NULL, and 
potentially,
there can be good amount of rows with NULL.  Just wondering...

--
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/



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



Re: [PHP-DB] fetching image by url and storing in mysql

2002-10-29 Thread 1LT John W. Holmes
You don't need filesize().

$fp = fopen('address_to_image','r');
while(!feof($fp))
{ $image .= fread($fp,1); }

Something like that will work...

---John Holmes...

- Original Message - 
From: "Marcus Fleige" <[EMAIL PROTECTED]>
To: "PHP-Mailinglist" <[EMAIL PROTECTED]>
Sent: Tuesday, October 29, 2002 11:29 AM
Subject: [PHP-DB] fetching image by url and storing in mysql


hi there,

i would like to get an image from an web-url and store it into 
mysql-db.

inserting local images or images i upload to the server is no 
problem, but handling urls as images seems quite difficult..

now, for fopen() i need the filesize() of the image, but that command 
does not work on urls...

anyone got an idea how to solve this, perhaps even without writing an 
temporary image to disk? code snippets anyone?

thanks so far,
greetings from germany!

marcus
--
^v^
[EMAIL PROTECTED]



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


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




[PHP-DB] fetching image by url and storing in mysql

2002-10-29 Thread Marcus Fleige
hi there,

i would like to get an image from an web-url and store it into
mysql-db.

inserting local images or images i upload to the server is no
problem, but handling urls as images seems quite difficult..

now, for fopen() i need the filesize() of the image, but that command
does not work on urls...

anyone got an idea how to solve this, perhaps even without writing an
temporary image to disk? code snippets anyone?

thanks so far,
greetings from germany!

marcus
--
^v^
[EMAIL PROTECTED]



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




[PHP-DB] new to cookies

2002-10-29 Thread Seabird
Hi everyone,

I created a login on my page that handles with a session. I also would like
to add a cookie so that people don't have to sign in every time they visit
my page, but I have no clue how to create it. Is there anyone out there
willing to help?

my login script:



  
  
  
  
  please fill in the required
fields.
  
';
 }
 // authenticate.
 if(!get_magic_quotes_gpc()) {
  $_POST['uname'] = addslashes($_POST['uname']);
 }
 $check = $db_object->query("SELECT username, password FROM users WHERE
username = '".$_POST['uname']."'");
 if(DB::isError($check)) {
  print '

  
  
  
  
  username doesn\'t exist. sign up
here
  
';
 }
 $info = $check->fetchRow();
 // check passwords match
 $_POST['passwd'] = stripslashes($_POST['passwd']);
 $info['password'] = stripslashes($info['password']);
 $_POST['passwd'] = md5($_POST['passwd']);
 if($_POST['passwd'] != $info['password']) {
  print '

  
  
  
  
  wrong password, try again
  
';
 }

 // if we get here username and password are correct, register session
variables and set
 // last login time.
 $date = date('m d, Y');
 $update_login = $db_object->query("UPDATE users SET last_login = '$date'
WHERE username = '".$_POST['uname']."'");
 $_POST['uname'] = stripslashes($_POST['uname']);
 $_SESSION['username'] = $_POST['uname'];
 $_SESSION['password'] = $_POST['passwd'];
 $db_object->disconnect();
?>
WelcomeYou are logged in as:





  
  
  
  
  sign up
here 
  


I use a MySQL DB to store user-info.
Jacco

ps (if this is the wrong forum to ask this, then let me know and I'll post
it elsewhere.

--
http://seabird.jmtech.ca

Attitude is Everything!
But Remember, Attitudes are Contagious!
Is Yours worth Catching



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




RE: [PHP-DB] Converting database from MS Access to MySQL on Linux

2002-10-29 Thread SELPH,JASON (HP-Richardson,ex1)
I use this, it has a nag screen but doesn't require any money.

http://www.accessmysql.com/

works as an access plugin, just select an access table, point it to your
mysql db and click a button.  easy to use.

-Original Message-
From: Matthew Hildebrand [mailto:gosherm@;byu.edu]
Sent: Tuesday, October 29, 2002 10:14 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Converting database from MS Access to MySQL on
Linux


Oops... my mistake.  I gave the wrong link. Here's the correct link:
http://www.devhood.com/Tools/tool_details.aspx?tool_id=758

--Matthew

-Original Message-
From: 1LT John W. Holmes [mailto:holmes072000@;charter.net] 
Sent: Tuesday, October 29, 2002 8:44 AM
To: Matthew Hildebrand
Subject: Re: [PHP-DB] Converting database from MS Access to MySQL on
Linux

He wants Access to MySQL, not MySQL to Access...unless the tool does
both?

John
- Original Message - 
From: "Matthew Hildebrand" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, October 29, 2002 10:07 AM
Subject: RE: [PHP-DB] Converting database from MS Access to MySQL on
Linux


> http://www.devhood.com/Tools/tool_details.aspx?tool_id=759
> I've been very happy with this tool, and it is well worth the cost.
> --Matthew
> 
> -Original Message-
> From: Soma Shekhar K [mailto:somashekhark@;yahoo.com] 
> Sent: Tuesday, October 29, 2002 6:11 AM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: [PHP-DB] Converting database from MS Access to MySQL on Linux
> 
> Sir,
> 
> Can u pls help in "Converting database from MS Access
> to MySQL on Linux". Pls send the code for converting. 
> 
> Bye
> Som
> 
> __
> Do you Yahoo!?
> HotJobs - Search new jobs daily now
> http://hotjobs.yahoo.com/
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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

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




RE: [PHP-DB] Converting database from MS Access to MySQL on Linux

2002-10-29 Thread Matthew Hildebrand
Oops... my mistake.  I gave the wrong link. Here's the correct link:
http://www.devhood.com/Tools/tool_details.aspx?tool_id=758

--Matthew

-Original Message-
From: 1LT John W. Holmes [mailto:holmes072000@;charter.net] 
Sent: Tuesday, October 29, 2002 8:44 AM
To: Matthew Hildebrand
Subject: Re: [PHP-DB] Converting database from MS Access to MySQL on
Linux

He wants Access to MySQL, not MySQL to Access...unless the tool does
both?

John
- Original Message - 
From: "Matthew Hildebrand" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, October 29, 2002 10:07 AM
Subject: RE: [PHP-DB] Converting database from MS Access to MySQL on
Linux


> http://www.devhood.com/Tools/tool_details.aspx?tool_id=759
> I've been very happy with this tool, and it is well worth the cost.
> --Matthew
> 
> -Original Message-
> From: Soma Shekhar K [mailto:somashekhark@;yahoo.com] 
> Sent: Tuesday, October 29, 2002 6:11 AM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: [PHP-DB] Converting database from MS Access to MySQL on Linux
> 
> Sir,
> 
> Can u pls help in "Converting database from MS Access
> to MySQL on Linux". Pls send the code for converting. 
> 
> Bye
> Som
> 
> __
> Do you Yahoo!?
> HotJobs - Search new jobs daily now
> http://hotjobs.yahoo.com/
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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




[PHP-DB] exporting to xml

2002-10-29 Thread Martin Hudec
Hello,

  i am creating script which will make select and desc to table and
  then based on results it will make xml file...all is okay, but on my
  IE it takes it as xml file (it is okay) BUT on my screen I dont see
  any of  tags...how can i override that?

  script is here:

header("Content-type: text/xml");

db related stuff...

$fcount = mysql_num_fields($result);

print ""; //will be table name

while($row = mysql_fetch_array($result)){
print "";
for($i=0; $i<$fcount; $i++){
$tag = mysql_field_name($result,$i);
print "<$tag>". $row[$i]. "";
}
print "";
}

-- 
Best regards,
 Martin  mailto:corwin@;corwin.sk


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




Re: [PHP-DB] Interbase BLOB problem

2002-10-29 Thread Peter Beckman
Your SQL query doesn't need that semicolon at the end of the query -- lose
it.

I never used ibase, so here's what I found from the PHP Manual page for
ibase_query:

Using BLOB

Insert BLOB:

/* create blob */
$blob_id = ibase_blob_create();

/* fill blob */
ibase_blob_add($blob_id, $var_datablob);

/* close new blob */
$blob_id_str = ibase_blob_close($blob_id);

/* insert into table */
ibase_query("INSERT INTO BLOB_TABLE (ID, BLOB) VALUES (1, ?)",$blob_id_str);

Open BLOB:

/* query */
$set = ibase_query("SELECT BLOB FROM BLOB_TABLE WHERE ID = 1");

/* fetche a row */
$row = ibase_fetch_object($set);

/* open BLOB for read */
$blob_id = ibase_blob_open($row->BLOB);

/* get BLOB data */
$stringBLOB = ibase_blob_get($blob_id);

/* print BLOB */
echo $stringBLOB;

/* close new blob */
ibase_blob_close($blob_id);

/* free result */
ibase_free_result($set);

Peter

On Tue, 29 Oct 2002, David Russell wrote:

> Hi all,
>
> I have a file I need to insert into a blob in a interbase table. Code as
> follows:
>
> $filehandle = fopen($file, "r");
> $blob_id = ibase_blob_import($filehandle);
> $qry = "INSERT INTO BPFATTACHMENTS ";
> $qry = $qry . "(BPFATTACHMENTNO, BPF, ATTACHMENTTYPE, FILENAME,
> FILESIZE, ATTACHMENT)";
> $qry = $qry . "VALUES";
> $qry = $qry . "($bpfAttNo, $BPFNo, $AttachmentType, '$file_name',
> $file_size, ?);";
> $res = ibase_query($qry, $blob_id);
>
> I have a ibase_pconnect prior to this.
>
> The problem is that is only adds a tiny part of the file (ie 5k of the
> 200k file) What should I be looking for?
>
> Thanks
>
> David Russell
> IT Support Manager
> Barloworld Optimus (Pty) Ltd
> Tel: +2711 444-7250
> Fax: +2711 444-7256
> e-mail: [EMAIL PROTECTED]
> web: www.BarloworldOptimus.com
>

---
Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation
[EMAIL PROTECTED] http://www.purplecow.com/
---


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




RE: [PHP-DB] Converting database from MS Access to MySQL on Linux

2002-10-29 Thread Matthew Hildebrand
http://www.devhood.com/Tools/tool_details.aspx?tool_id=759
I've been very happy with this tool, and it is well worth the cost.
--Matthew

-Original Message-
From: Soma Shekhar K [mailto:somashekhark@;yahoo.com] 
Sent: Tuesday, October 29, 2002 6:11 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: [PHP-DB] Converting database from MS Access to MySQL on Linux

Sir,

Can u pls help in "Converting database from MS Access
to MySQL on Linux". Pls send the code for converting. 

Bye
Som

__
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/

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



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




Re: [PHP-DB] Converting database from MS Access to MySQL on Linux

2002-10-29 Thread 1LT John W. Holmes
> Can u pls help in "Converting database from MS Access
> to MySQL on Linux". Pls send the code for converting.

http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=Converting+database+f
rom+MS+Access+to+MySQL+on+Linux

---John Holmes...


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




[PHP-DB] Converting database from MS Access

2002-10-29 Thread Soma Shekhar K
Sir,

Can u pls help in "Converting database from MS Access
to MySQL on Linux". Pls send the code for converting. 

Bye
Som



__
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/

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




[PHP-DB] Converting database from MS Access to MySQL on Linux

2002-10-29 Thread Soma Shekhar K
Sir,

Can u pls help in "Converting database from MS Access
to MySQL on Linux". Pls send the code for converting. 

Bye
Som

__
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/

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




[PHP-DB] Interbase BLOB problem

2002-10-29 Thread David Russell
Hi all,

I have a file I need to insert into a blob in a interbase table. Code as
follows:

$filehandle = fopen($file, "r");
$blob_id = ibase_blob_import($filehandle);
$qry = "INSERT INTO BPFATTACHMENTS ";
$qry = $qry . "(BPFATTACHMENTNO, BPF, ATTACHMENTTYPE, FILENAME,
FILESIZE, ATTACHMENT)";
$qry = $qry . "VALUES";
$qry = $qry . "($bpfAttNo, $BPFNo, $AttachmentType, '$file_name',
$file_size, ?);";
$res = ibase_query($qry, $blob_id);

I have a ibase_pconnect prior to this.

The problem is that is only adds a tiny part of the file (ie 5k of the
200k file) What should I be looking for?

Thanks

David Russell
IT Support Manager
Barloworld Optimus (Pty) Ltd
Tel: +2711 444-7250 
Fax: +2711 444-7256
e-mail: [EMAIL PROTECTED]
web: www.BarloworldOptimus.com



smime.p7s
Description: application/pkcs7-signature


Re[2]: [PHP-DB] database synchronization

2002-10-29 Thread Martin Hudec
Hello Juhan,

JK> So you can't determine database servers' ip addresses, since they may or
JK> may not be dynamic. So don't use the ip address, use hostname and
JK> update this hostname every time ip-address changes. You can do it with
JK> your own scripts and local host file or you can use public services like
JK> www.dyndns.org offers.

well i thought about writing script that will check for connections on
my server on mysql portit will extract IP or hostname of host
making connection and use it in downloading binlog filebut ill
check also that service you mentioned

thank you

-- 
Best regards,
 Martinmailto:corwin@;corwin.sk


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




Re[6]: [PHP-DB] database synchronization

2002-10-29 Thread Martin Hudec
Hello,

see below...

-- 
Best regards,
 Martinmailto:corwin@;corwin.sk

Tuesday, October 29, 2002, 10:51:17 AM, you wrote:

PL> Hi

PL> If the records are all independant - ie travel agent (TA) A has their own
PL> records and so does TA B then REPLACE INTO MainDB SELECT * FROM
PL> Travel_agent_A_DB so the main database is just receiveing updated records
PL> from the TAs.

Yes they are independenteach record has column named originTA
where i will put ID of TA which is originator of record

PL> Travel agent logs in to master php driven site .
PL> master php driven site logs TA IP
PL> master php driven site makes connection to TA mysql using IP

Looks like i will have to write script which will monitor connection
to MySQL port on master php driven site...

PL> master php driven site gets new/updated records
PL> master php driven site writes new/updated records to master DB

okay understand ;)

PL> If more than one travel agent can update the same record then you risk
PL> corrupting the data. If they do not have a live connection to the master
PL> then the record they update may itself be out of date. The only way I can
PL> see of doing this is soem system that locks a record for the period that TA
PL> might take updating it.

so on MainDB (our slave server :)i will create database for each partner
with designated unique name for ex. Travel_agent_A_DB...here will i
put all updated info..or I will put it to mainDBthat risk of
corruption is out of talk, because each record will have its id of
origin (Travel_agent_A_DB).at least I hope...:) and each travel
agent will update only their records(...WHERE
idorigin="Travel_agent_A")...

I think with this i can forget about that riskthey are updating
only their recordsnot anyone else's...in example

Travel_agent_A offers Greece in 10 days from 19.6.2003 to
29.6.2003...same destination
Travel_agent_B offers Greece in 10 days from 19.6.2003 to
29.6.2003...same destination

Travel_agent_A sells out all he can in to this days...but agent_B
still has few places ;))

update will work as followsagent_A will update his set of
records...setting them all sold outagent_B will update his set of
records setting ten places left to be sold

PL> Perhaps

PL> TA A login
PL> TA grab record, mark as locked
PL> TA B gets 'locked record' message
PL> TA A updates record and writes back to master
PL> record marked as not locked

Looks good...if my upper solution will not work i will try to use
this...


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




RE: Re[4]: [PHP-DB] database synchronization

2002-10-29 Thread Peter Lovatt
Hi

If the records are all independant - ie travel agent (TA) A has their own
records and so does TA B then REPLACE INTO MainDB SELECT * FROM
Travel_agent_A_DB so the main database is just receiveing updated records
from the TAs.

Travel agent logs in to master php driven site .
master php driven site logs TA IP
master php driven site makes connection to TA mysql using IP
master php driven site gets new/updated records
master php driven site writes new/updated records to master DB

If more than one travel agent can update the same record then you risk
corrupting the data. If they do not have a live connection to the master
then the record they update may itself be out of date. The only way I can
see of doing this is soem system that locks a record for the period that TA
might take updating it.

Perhaps

TA A login
TA grab record, mark as locked
TA B gets 'locked record' message
TA A updates record and writes back to master
record marked as not locked

HTH

Peter

---
Excellence in internet and open source software
---
Sunmaia
www.sunmaia.net
tel. 0121-242-1473
---

-Original Message-
From: Martin Hudec [mailto:corwin@;corwin.sk]
Sent: 29 October 2002 09:18
To: Peter Lovatt
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re[4]: [PHP-DB] database synchronization


Hello Peter,

okay :)))so far I understand...buthmmm let me explain

I have server of travel agencies records (we need to update this, so
it is slave) with stable IPand then bunch of other computers (from
these we are updating...so they are all masters) in various travel
agencies...but not all of them have stable IP (some joins using
dialup...some have stable line)...some girl there updates
database...and they may not be on net:).
So in this case i have one slave and many masters.

solution one:

My server (slave) has to periodically check for updateswhen
masters have stable IP I can make list of IPs and then connect to each
server and take binary update log...and use itbut what can i do
when master has dynamic IP? So i discard this solution

solution two...better...from my point of view ;):

Masters with stable IP will update in period of for example 4
hoursmasters with dynamic IP will update when they are online
(girl browsing on chatting sites ;)))that puts the question if
there is possible to make remote update (sending binlog from master to
slave and automatically updating slave)(but if i understood your
previous mail...synchronization (replication) is done automaticaly
the question two is what if this master is running Windows 98 with
MySQL-win for example? Is that possible to make also in windows?

I will try to post this also to mysql list

--
Best regards,
 Martinmailto:corwin@;corwin.sk

Tuesday, October 29, 2002, 10:05:00 AM, you wrote:

PL> Hi

PL> Replication works continuously when the two databases are in contact
with
PL> each other, unless you specify otherwise. Likewise, if you connect
PL> periodically, MySql will synchronise the two databases itself.

PL> With replication, MySql logs everything the master does. When a slave
logs
PL> in (you can have any number of slaves) it checks the master logs to see
how
PL> up to date it is, and 'catches up' with the master.

PL> Once it is set up correctly you don't need to do anything yourself.

PL> HTH

PL> Peter

PL> ---
PL> Excellence in internet and open source software
PL> ---
PL> Sunmaia
PL> www.sunmaia.net
PL> tel. 0121-242-1473
PL> ---


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



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




Re: [PHP-DB] database synchronization

2002-10-29 Thread Juhan Kundla
Hei!

Ühel ilusal päeval [29-10-2002 12:14] kirjutas Martin Hudec:
> Hello Peter,

I'm not Peter and i don't know, if i can help, but here is one idea.

> I have server of travel agencies records (we need to update this, so
> it is slave) with stable IPand then bunch of other computers (from
> these we are updating...so they are all masters) in various travel
> agencies...but not all of them have stable IP (some joins using
> dialup...some have stable line)...some girl there updates
> database...and they may not be on net:).
> So in this case i have one slave and many masters.

So you can't determine database servers' ip addresses, since they may or
may not be dynamic. So don't use the ip address, use hostname and
update this hostname every time ip-address changes. You can do it with
your own scripts and local host file or you can use public services like
www.dyndns.org offers.

Juhan

-- 
Vastus: Sest inimene loeb suunaga ülevalt alla.
Küsimus: Miks ülalpool vastamine on halb?

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




Re[4]: [PHP-DB] database synchronization

2002-10-29 Thread Martin Hudec
Hello Peter,

okay :)))so far I understand...buthmmm let me explain

I have server of travel agencies records (we need to update this, so
it is slave) with stable IPand then bunch of other computers (from
these we are updating...so they are all masters) in various travel
agencies...but not all of them have stable IP (some joins using
dialup...some have stable line)...some girl there updates
database...and they may not be on net:).
So in this case i have one slave and many masters.

solution one:

My server (slave) has to periodically check for updateswhen
masters have stable IP I can make list of IPs and then connect to each
server and take binary update log...and use itbut what can i do
when master has dynamic IP? So i discard this solution

solution two...better...from my point of view ;):

Masters with stable IP will update in period of for example 4
hoursmasters with dynamic IP will update when they are online
(girl browsing on chatting sites ;)))that puts the question if
there is possible to make remote update (sending binlog from master to
slave and automatically updating slave)(but if i understood your
previous mail...synchronization (replication) is done automaticaly
the question two is what if this master is running Windows 98 with
MySQL-win for example? Is that possible to make also in windows?

I will try to post this also to mysql list

-- 
Best regards,
 Martinmailto:corwin@;corwin.sk

Tuesday, October 29, 2002, 10:05:00 AM, you wrote:

PL> Hi

PL> Replication works continuously when the two databases are in contact with
PL> each other, unless you specify otherwise. Likewise, if you connect
PL> periodically, MySql will synchronise the two databases itself.

PL> With replication, MySql logs everything the master does. When a slave logs
PL> in (you can have any number of slaves) it checks the master logs to see how
PL> up to date it is, and 'catches up' with the master.

PL> Once it is set up correctly you don't need to do anything yourself.

PL> HTH

PL> Peter

PL> ---
PL> Excellence in internet and open source software
PL> ---
PL> Sunmaia
PL> www.sunmaia.net
PL> tel. 0121-242-1473
PL> ---


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




RE: Re[2]: [PHP-DB] database synchronization

2002-10-29 Thread Peter Lovatt
Hi

Replication works continuously when the two databases are in contact with
each other, unless you specify otherwise. Likewise, if you connect
periodically, MySql will synchronise the two databases itself.

With replication, MySql logs everything the master does. When a slave logs
in (you can have any number of slaves) it checks the master logs to see how
up to date it is, and 'catches up' with the master.

Once it is set up correctly you don't need to do anything yourself.

HTH

Peter

---
Excellence in internet and open source software
---
Sunmaia
www.sunmaia.net
tel. 0121-242-1473
---

-Original Message-
From: Martin Hudec [mailto:corwin@;corwin.sk]
Sent: 29 October 2002 08:44
To: Peter Lovatt
Cc: [EMAIL PROTECTED]
Subject: Re[2]: [PHP-DB] database synchronization


Hello Peter,

nice readinglooks like i need to get binary log with queries that
modified some data...okayand use queries from this log on our
slave databaseokay

mysqlbinlog log-file | mysql -h server_name

i suppose server_name is hostname but what if this hostname
changes (or IP)

looks like all i have to do is setup to create binary log on master
(other server with various IPs)then on our machine i will set up
script which will check for new log files in example each 4 hours and
use themfirst question...how will i use queries from logfile to
update mine database? and what if other (master) server is not online
(dialup)? Should i make that master server connect to our
server?...Because i think it will be better to send those log files
directly to slave server with stable and well known IP...and make
remote updatethan to try to find changing ip of master
serverthat puts me to another problem...what if master is running
windows? I can create these scripts on linux..but what on windows?


--
Best regards,
 Martinmailto:corwin@;corwin.sk

Tuesday, October 29, 2002, 9:29:43 AM, you wrote:

PL> Hi

PL> Take a look at replication

PL> http://www.mysql.com/doc/en/Replication.html

PL> HTH

PL> Peter

PL> ---
PL> Excellence in internet and open source software
PL> ---
PL> Sunmaia
PL> www.sunmaia.net
PL> tel. 0121-242-1473
PL> ---

PL> -Original Message-
PL> From: Martin Hudec [mailto:corwin@;corwin.sk]
PL> Sent: 29 October 2002 08:18
PL> To: [EMAIL PROTECTED]
PL> Subject: [PHP-DB] database synchronization


PL> Hello,

PL>   maybe this is not to be posted here but I am working on this
PL>   using PHP and MySQL (one application for travel agencies)

PL>   Does someone know how to synchronize automatically two
PL>   databasesi have one database running on my server with
PL>   static IP and another, from which we are taking updated records,
PL>   on another computer with static or dynamic IP.has someone
PL>   tried to solve this?

PL> --
PL> Best regards,
PL>  Martin  mailto:corwin@;corwin.sk


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




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




Re[2]: [PHP-DB] database synchronization

2002-10-29 Thread Martin Hudec
Hello Peter,

nice readinglooks like i need to get binary log with queries that
modified some data...okayand use queries from this log on our
slave databaseokay

mysqlbinlog log-file | mysql -h server_name

i suppose server_name is hostname but what if this hostname
changes (or IP)

looks like all i have to do is setup to create binary log on master
(other server with various IPs)then on our machine i will set up
script which will check for new log files in example each 4 hours and
use themfirst question...how will i use queries from logfile to
update mine database? and what if other (master) server is not online
(dialup)? Should i make that master server connect to our
server?...Because i think it will be better to send those log files
directly to slave server with stable and well known IP...and make
remote updatethan to try to find changing ip of master
serverthat puts me to another problem...what if master is running
windows? I can create these scripts on linux..but what on windows?


-- 
Best regards,
 Martinmailto:corwin@;corwin.sk

Tuesday, October 29, 2002, 9:29:43 AM, you wrote:

PL> Hi

PL> Take a look at replication

PL> http://www.mysql.com/doc/en/Replication.html

PL> HTH

PL> Peter

PL> ---
PL> Excellence in internet and open source software
PL> ---
PL> Sunmaia
PL> www.sunmaia.net
PL> tel. 0121-242-1473
PL> ---  

PL> -Original Message-
PL> From: Martin Hudec [mailto:corwin@;corwin.sk]
PL> Sent: 29 October 2002 08:18
PL> To: [EMAIL PROTECTED]
PL> Subject: [PHP-DB] database synchronization


PL> Hello,

PL>   maybe this is not to be posted here but I am working on this
PL>   using PHP and MySQL (one application for travel agencies)

PL>   Does someone know how to synchronize automatically two
PL>   databasesi have one database running on my server with
PL>   static IP and another, from which we are taking updated records,
PL>   on another computer with static or dynamic IP.has someone
PL>   tried to solve this?

PL> -- 
PL> Best regards,
PL>  Martin  mailto:corwin@;corwin.sk


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


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




RE: [PHP-DB] database synchronization

2002-10-29 Thread Peter Lovatt
Hi

Take a look at replication

http://www.mysql.com/doc/en/Replication.html

HTH

Peter

---
Excellence in internet and open source software
---
Sunmaia
www.sunmaia.net
tel. 0121-242-1473
---  

-Original Message-
From: Martin Hudec [mailto:corwin@;corwin.sk]
Sent: 29 October 2002 08:18
To: [EMAIL PROTECTED]
Subject: [PHP-DB] database synchronization


Hello,

  maybe this is not to be posted here but I am working on this
  using PHP and MySQL (one application for travel agencies)

  Does someone know how to synchronize automatically two
  databasesi have one database running on my server with
  static IP and another, from which we are taking updated records,
  on another computer with static or dynamic IP.has someone
  tried to solve this?

-- 
Best regards,
 Martin  mailto:corwin@;corwin.sk


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




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




[PHP-DB] database synchronization

2002-10-29 Thread Martin Hudec
Hello,

  maybe this is not to be posted here but I am working on this
  using PHP and MySQL (one application for travel agencies)

  Does someone know how to synchronize automatically two
  databasesi have one database running on my server with
  static IP and another, from which we are taking updated records,
  on another computer with static or dynamic IP.has someone
  tried to solve this?

-- 
Best regards,
 Martin  mailto:corwin@;corwin.sk


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