[PHP-DB] Date Comparsion

2002-06-18 Thread Jack

Dear all
I had a form which let user to input the leave_from and leave_to date into,
the format of the date that user input is -mm-dd.
Now i want to compare the leave_from and leave_to date to find out the
number of days between!

What should i do or any function in php can provide this operation?


--
Thx a lot!
Jack
[EMAIL PROTECTED]



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




[PHP-DB] execute external sql script in php

2002-06-18 Thread fabrizio

Hello dear all, 

i try to execute an external sql-script to the mysql server

$query =source /home/mysql/mysql_script


...but allways i get Impossible to execute the query

any idea to do a stuff like this?

thanks

fabrizio

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




Re: [PHP-DB] execute external sql script in php

2002-06-18 Thread Jeffrey_N_Dyke


is this from within the browser?  if so, you'd need to open the file, read
the contents and execute the script.  I don't knwo what 'source' does.  but
i don't claim to know much either.  i may not have heard of this.

if you just want to do it from a command line then you use a  after your
login and password args

mysql -u user -p  /home/mysql/mysql_script

Hope this helps
Jeff


   
 
fabrizio   
 
fabrizio@sad.   To: [EMAIL PROTECTED]  
 
it  cc:   
 
 Subject: [PHP-DB] execute external sql 
script in php   
06/18/2002 
 
06:19 AM   
 
Please respond 
 
to fabrizio
 
   
 
   
 




Hello dear all,

i try to execute an external sql-script to the mysql server

$query =source /home/mysql/mysql_script


...but allways i get Impossible to execute the query

any idea to do a stuff like this?

thanks

fabrizio

--
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] execute external sql script in php

2002-06-18 Thread fabrizio

Jeff, 

source command in mysql shell is the same like

mysql -u user -p  /home/mysql/mysql_script.

if i'm in the mysql shell i do:

mysql source /home/mysql/mysql_script;

...to execute the script. this look to work like a normal query, 
but in my php script dont work!

what's wrong?

regards,
fabrizio 

On Tuesday 18 June 2002 13:22, [EMAIL PROTECTED] wrote:
 is this from within the browser?  if so, you'd need to open the file, read
 the contents and execute the script.  I don't knwo what 'source' does.  but
 i don't claim to know much either.  i may not have heard of this.

 if you just want to do it from a command line then you use a  after your
 login and password args

 mysql -u user -p  /home/mysql/mysql_script

 Hope this helps
 Jeff



 fabrizio
 fabrizio@sad.   To: [EMAIL PROTECTED]
 it  cc:
  Subject: [PHP-DB] execute
 external sql script in php 06/18/2002
 06:19 AM
 Please respond
 to fabrizio






 Hello dear all,

 i try to execute an external sql-script to the mysql server

 $query =source /home/mysql/mysql_script


 ...but allways i get Impossible to execute the query

 any idea to do a stuff like this?

 thanks

 fabrizio

 --
 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] MySQL Clustering, redundancy

2002-06-18 Thread Matt Babineau

Hi All:
 
I quickly skimmed the MySQL manual and didn't see any information on
clustering. Does MySQL have any support for clustering or some type of
redundant failover systems?
 
Thanks!
 
Matt Babineau
Freelance Internet Developer
-
e:  mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
p: 603.943.4237
w:  http://www.criticalcode.com/ http://www.criticalcode.com
PO BOX 601
Manchester, NH 03105
 



Re: [PHP-DB] MySQL Clustering, redundancy

2002-06-18 Thread Adam Voigt

Yes,it's called Replication in the MySQL documentation.
However, since the info in the manual is kind of sparse so I would hop
on google and do a search for specific instructions on how to do it when
your ready, but to answer your question, yes, MySQL does do
Redundancy/Failover. (Ofcourse you must take account of this in your
code interacting with the server, but the data will be sync'd).

Adam Voigt
[EMAIL PROTECTED]

On Tue, 2002-06-18 at 08:47, Matt Babineau wrote:
 Hi All:
  
 I quickly skimmed the MySQL manual and didn't see any information on
 clustering. Does MySQL have any support for clustering or some type of
 redundant failover systems?
  
 Thanks!
  
 Matt Babineau
 Freelance Internet Developer
 -
 e:  mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
 p: 603.943.4237
 w:  http://www.criticalcode.com/ http://www.criticalcode.com
 PO BOX 601
 Manchester, NH 03105
  



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




RE: [PHP-DB] MySQL Clustering, redundancy

2002-06-18 Thread Matt Babineau

Thanks for your response Adam! 

Do you know if there is any way MySQL can be spread across multiple
machines? I am looking at a huge application for a client, that will
need to support thousands of simultaneous users. I am wondering if MySQL
can handle load like that. That's why I was asking about clustering
MySQL servers for the ability to handle more users simultaneously.

Has anyone had any experience with a large scale application on MySQL?

Matt Babineau
Freelance Internet Developer
-
e: [EMAIL PROTECTED]
p: 603.943.4237
w: http://www.criticalcode.com
PO BOX 601
Manchester, NH 03105


-Original Message-
From: Adam Voigt [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, June 18, 2002 8:55 AM
To: [EMAIL PROTECTED]
Cc: Matt Babineau
Subject: Re: [PHP-DB] MySQL Clustering, redundancy


Yes,it's called Replication in the MySQL documentation. However, since
the info in the manual is kind of sparse so I would hop on google and do
a search for specific instructions on how to do it when your ready, but
to answer your question, yes, MySQL does do Redundancy/Failover.
(Ofcourse you must take account of this in your code interacting with
the server, but the data will be sync'd).

Adam Voigt
[EMAIL PROTECTED]

On Tue, 2002-06-18 at 08:47, Matt Babineau wrote:
 Hi All:
  
 I quickly skimmed the MySQL manual and didn't see any information on 
 clustering. Does MySQL have any support for clustering or some type of

 redundant failover systems?
  
 Thanks!
  
 Matt Babineau
 Freelance Internet Developer
 -
 e:  mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
 p: 603.943.4237
 w:  http://www.criticalcode.com/ http://www.criticalcode.com PO BOX 
 601 Manchester, NH 03105
  



-- 
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] MySQL Clustering, redundancy

2002-06-18 Thread Adam Voigt

I have never actually tried to program against something which talks to
multiple DB's, the quickest way would be in your DB connection code to
have something that will either:

A. Try the first DB and connect to the second if it's down.
B. Randomly choose a SQL server.

The most fluid solution I could think of would be an application
gateway of some sort which will load balance properly to different IP's
while in your code you only point to one.

Adam Voigt
[EMAIL PROTECTED]

On Tue, 2002-06-18 at 09:12, Matt Babineau wrote:
 Thanks for your response Adam! 
 
 Do you know if there is any way MySQL can be spread across multiple
 machines? I am looking at a huge application for a client, that will
 need to support thousands of simultaneous users. I am wondering if MySQL
 can handle load like that. That's why I was asking about clustering
 MySQL servers for the ability to handle more users simultaneously.
 
 Has anyone had any experience with a large scale application on MySQL?
 
 Matt Babineau
 Freelance Internet Developer
 -
 e: [EMAIL PROTECTED]
 p: 603.943.4237
 w: http://www.criticalcode.com
 PO BOX 601
 Manchester, NH 03105
 
 
 -Original Message-
 From: Adam Voigt [mailto:[EMAIL PROTECTED]] 
 Sent: Tuesday, June 18, 2002 8:55 AM
 To: [EMAIL PROTECTED]
 Cc: Matt Babineau
 Subject: Re: [PHP-DB] MySQL Clustering, redundancy
 
 
 Yes,it's called Replication in the MySQL documentation. However, since
 the info in the manual is kind of sparse so I would hop on google and do
 a search for specific instructions on how to do it when your ready, but
 to answer your question, yes, MySQL does do Redundancy/Failover.
 (Ofcourse you must take account of this in your code interacting with
 the server, but the data will be sync'd).
 
 Adam Voigt
 [EMAIL PROTECTED]
 
 On Tue, 2002-06-18 at 08:47, Matt Babineau wrote:
  Hi All:
   
  I quickly skimmed the MySQL manual and didn't see any information on 
  clustering. Does MySQL have any support for clustering or some type of
 
  redundant failover systems?
   
  Thanks!
   
  Matt Babineau
  Freelance Internet Developer
  -
  e:  mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
  p: 603.943.4237
  w:  http://www.criticalcode.com/ http://www.criticalcode.com PO BOX 
  601 Manchester, NH 03105
   
 
 
 
 -- 
 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] [php][odbc_connect]

2002-06-18 Thread Michel.Buchmann

Hi everyone,

what this message means:
Fatal error: Call to undefined function: odbc_connect() in /path/to/file.php

thx for helping

Regards from Switzerland,

Michel Buchmann


***
This e-mail message is intended only for the addressee(s) and contains 
information which may be confidential. If you are not the intended 
recipient please do not read, save, forward, disclose or copy the contents 
of this e-mail. If this e-mail has been sent to you in error, please delete this 
e-mail and any copies or links to this e-mail completely and immediately 
from your system. We also like to inform you that communication via e-mail 
over the Internet is insecure because third parties may have the possibility 
to access and manipulate e-mails.

Any views expressed in this message are those of the individual sender, 
except where the sender specifically states them to be the views of 
The Swatch Group Ltd.
***



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


RE: [PHP-DB] MS Access DB Open as file ?

2002-06-18 Thread Andrew Hill

Hi Ivan,

Check out the ODBC chapter in Professional PHP4 (Wrox Press) and also
read the PHP HOWTO at www.iodbc.org for an explanation of ODBC in PHP -
the short answer to your question can I connect to Access is maybe.
A lot of it depends on your platform and available drivers.

Best regards,
Andrew Hill
Director of Technology Evangelism
OpenLink Software  http://www.openlinksw.com
Universal Data Access  Virtuoso Universal Server

-Original Message-
From: Ivan Lam [mailto:[EMAIL PROTECTED]] 
Sent: Friday, June 07, 2002 11:24 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MS Access DB Open as file ?

Hi All,
I'm new in PHP and I whether I can open a MS Access database
file
directly with PHP?
There is a thing called ODBC but in the function odbc_connect(),
The
first parameter is something called dsn, what's that? And does that mean
I
can't open the MS Access database directly by somehow only giving it's
path?
Thanks.
Ivan




-- 
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] [php][odbc_connect]

2002-06-18 Thread Andrew Hill

Michel,

It means that ODBC support is not enabled in your PHP instance.
Check the output of phpinfo(); for ODBC.

If this is *nix, you need to link in an ODBC Driver Manager (such as
iODBC, see the PHP HOWTO at www.iodbc.org) and install an ODBC Driver.

If this is Windows, you need to uncomment the ODBC dll statement in the
php.ini.

Hope this helps!

Best regards,
Andrew Hill
Director of Technology Evangelism
OpenLink Software  http://www.openlinksw.com
Universal Data Access  Virtuoso Universal Server

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, June 18, 2002 9:20 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] [php][odbc_connect]

Hi everyone,

what this message means:
Fatal error: Call to undefined function: odbc_connect() in
/path/to/file.php

thx for helping

Regards from Switzerland,

Michel Buchmann



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




[PHP-DB] Re: Date Comparsion

2002-06-18 Thread Lee Doolan

 Jack == Jack  [EMAIL PROTECTED] writes:

Jack Dear all I had a form which let user to input the leave_from
Jack and leave_to date into, the format of the date that user
Jack input is -mm-dd.  Now i want to compare the leave_from
Jack and leave_to date to find out the number of days between!

well, here's one way:

$interval_days= (strtotime($to_date) - strtotime($from_date)) / 3600 * 24

adjust to taste.


-- 
When the birdcage is open,   | donate to causes I care about: 
the selfish bird flies away, |http://svcs.affero.net/rm.php?r=leed_25
but the virtuous one stays.  |

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




Re: [PHP-DB] Get the ts of the last change???

2002-06-18 Thread Edward Marczak

On 6/17/02 5:18 AM, Alex Elderson [EMAIL PROTECTED] pressed the keys forming
the message:

 Hi,
 
 Is it possible to get the time of the last change of a mysql table?? in php?

Sure.  Try this:

$info = mysql_fetch_array(mysql_query(show table status from dbname like
'tablename'));
echo Last update for tablename: .$info[Update_time];

Enjoy.
-- 
Ed Marczak
[EMAIL PROTECTED]


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




Re: [PHP-DB] MySQL Clustering, redundancy

2002-06-18 Thread Edward Marczak

On 6/18/02 9:19 AM, Adam Voigt [EMAIL PROTECTED] pressed the keys
forming the message:

 I have never actually tried to program against something which talks to
 multiple DB's, the quickest way would be in your DB connection code to
 have something that will either:
 
 A. Try the first DB and connect to the second if it's down.
 B. Randomly choose a SQL server.
 
 The most fluid solution I could think of would be an application
 gateway of some sort which will load balance properly to different IP's
 while in your code you only point to one.

I vaguely remember an article talking about how to implement your choice A.
Try weberdev or maybe even webmonkey (heck - just try google.).
-- 
Ed Marczak
[EMAIL PROTECTED]


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




[PHP-DB] is it possible to upload (binary) files to a mysql database?

2002-06-18 Thread Sander Peters

Hello,

Is it possible to upload binary files to a mysql database?
I can't figure it out. This is what I did:

I made a form like this:

FORM ENCTYPE=multipart/form-data ACTION=upload.php METHOD=POST
INPUT TYPE=hidden name=MAX_FILE_SIZE value=20
Send this file: INPUT NAME=attachment TYPE=file
INPUT TYPE=submit VALUE=Send File
/FORM

My SQL Query is like this:
INSERT INTO ALBUMS ('file') VALUES '$attachment'
The field FILE is a type BLOB field.

The  first result I got in the database whas the tempdir+tempfile.
After that I choosed to ad $attachment_name into the database.
But only the filename is stored in the database. Is it not possible to store
files into the database?

What I did now in the script  is copying the file $attachment_name to a
share on the local network so that everyone can access files uploaded by
users.
This is not the meaning of it all, it should be stored in the database.

Can somebody help me with this?

Please reply me at: mailto:[EMAIL PROTECTED] (my e-mail at work)

Thanks in advance.

Sander Peters



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




[PHP-DB] SQL guru needed: Is this query possible ?

2002-06-18 Thread Max Sullivan

I've been racking my brain for too long trying to figure out how to do
this query, I don't think it should be too hard, but I just can't get it
right.  I've searched and read about every type of join I could find to
figure out a way of doing this, but I think I'm either overlooking
something simple or need a different table structure.  I'm trying this
in MySQL.
 
I've got the following tables broken down for simplicity.
 
procedure

id name

1  abc
2  def
 
provider

id name

1  ghi
2  jkl
 
 
procedure_equipment (each procedure may require more than one equipid)
-
id procedureid  equipid
-
1  1 1
2  1 2
3  2 1
 
 
provider_equipment (each provider may have more than one eqiupid
-
id providerid  equipid
-
1  1 1
2  1 2
3  2 1
 
 
What I am trying to do is get procedure.name from procedure where
provider.id = say 1 and the equipid's from both the procedure_equipment
and provider_equipment tables need to match.  Basically I want to get
the equipid's from provider_equipment where providerid = 1, then get the
procedureid from procedure_equipment where the provider_equipment's
equipid's equal that of the procedure_equipments equipid's (1 and 2).  
 
The problem I have is the fact that each equipid will be from their own
row and I don't know how to equate provider_equipment.equipid 1 AND 2
and procedure_equipment.equpiid 1 AND 2.
 
At first I tried the following query.  Just to quickly realize that I
would of course retrieve procedure.name for each equipid In the db.
SELECT procedure.name from procedure, procedure_equipment,
provider_equipment WHERE provider_equipment.providerid = '1' AND
provider_equipment.equipid = procedure_equipment.equipid.
 
Although I'd like to do this with one query, I've tried to think of a
way to do it with a couple of queries and again found short comings
doing it that way as well.  I'm beginning to think that the way I have
the tables set up won't allow me to query the way I want to and that I
may need to change the table structure.  Although it seems (to me
anyway) that I should be able to get this query to work if I can figure
out the correct way of running the query.
 
I'm hoping someone can offer some incite on this, if a query like this
is possible or not.  I don't normally post to the list as I like to try
to figure these things out on my own, but I'm really stumped on this
one.  I'm hoping there is a way of joining the tables, in a way I don't
yet know of or understand,  to get the results I want :) 
 
I'd really appreciate any help you can offer.
 
Thanks in advance
 
Max Sullivan