[PHP-DB] difference between two dates

2003-01-19 Thread Rajesh Fowkar
Hello,

In my application I am accepting Day, Month and Year from a Select List.
What I want to do is calculate the age of the person based on the above
selection.

$cboDD is the day variable
$cboMM is the month variable
$cboYY is the year variable

I tried this :

$dobtimestamp = mktime(0,0,0,$cboMM,$cboDD,$cboYY);
$todaytimestamp = time();
$txtAge = ($todaytimestamp - $dobtimestamp)/86400;

It does not give me the expected output.

Can anybody suggest something ?

Thanks in advance.


Peace

--
Rajesh *  [EMAIL PROTECTED]  *  http://www.symonds.net/~rajesh/
Powered By : Debian GNU/Linux 3.0 (Woody) - [Kernel 2.4.18(ext3),Mutt 1.5.1i]
What we anticipate seldom occurs; what we least expect generally happens.
-- Bengamin Disraeli

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




RE: [PHP-DB] difference between two dates

2003-01-19 Thread John W. Holmes
 In my application I am accepting Day, Month and Year from a Select
List.
 What I want to do is calculate the age of the person based on the
above
 selection.
 
 $cboDD is the day variable
 $cboMM is the month variable
 $cboYY is the year variable
 
 I tried this :
 
 $dobtimestamp = mktime(0,0,0,$cboMM,$cboDD,$cboYY);
 $todaytimestamp = time();
 $txtAge = ($todaytimestamp - $dobtimestamp)/86400;
 
 It does not give me the expected output.
 
 Can anybody suggest something ?

Keep your mktime() as it is, that's correct. Then use something like
this to calculate the age:

$age = date('Y',$now) - date('Y',$dob) -
((date('z',$now)=date('z',$dob)) ? 0 : 1);

where $dob and $now are the appropriate unix timestamps that you've
already got calculated with mktime() and time().

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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




[PHP-DB] php - excel

2003-01-19 Thread David Rice
Just a question, is it possible to dynamically create an excel spreadsheet 
from data in a mysql database the excel sheet does not have to be displayed, 
just to be sent to print, to give better print quality than a webpage tables 
equivalent.

Or is there another way of doing this?





_
MSN 8 with e-mail virus protection service: 2 months FREE* 
http://join.msn.com/?page=features/virus


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



RE: [PHP-DB] php - excel

2003-01-19 Thread John W. Holmes
 Just a question, is it possible to dynamically create an excel
spreadsheet
 from data in a mysql database the excel sheet does not have to be
 displayed,
 just to be sent to print, to give better print quality than a webpage
 tables
 equivalent.
 
 Or is there another way of doing this?

Easiest way is to just send Excel headers with header() instead of the
normal HTML headers. The data you send can be a regular HTML table, but
it'll open in Excel and be converted to a spreadsheet. Then the user can
format it however they want and print it. 

If that's not good enough, there are some other classes out there
that'll give you more control. Search google or look on phpclasses.org.

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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




[PHP-DB] Re: Apache/php will not start after upgrading Oracle from 8.1.7.3 to 8.1.7.4

2003-01-19 Thread Michael Mauch
Miguel Ward [EMAIL PROTECTED] wrote:

 Just upgraded my Oracle installation from 8.1.7.3 to 8.1.7.4.
 
 From that moment on, apache/php will not start (just hangs).
 
 Tried 'make'ing Apache and php again but same result.
 
 Checked oracle variables, etc and all seem to be okay (it was working fine).

http://www.php.net/manual/en/ref.oci8.php:

| If your webserver doesn't start or crashes at startup: Check that
| Apache is linked with the pthread library:

Regards...
Michael

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




[PHP-DB] PHP.ini

2003-01-19 Thread Sabina A. Schneider
Sorry... here is the attach!

  Sabina Alejandra Schneider
[EMAIL PROTECTED]


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


[PHP-DB] Fw: Windows 2000 problems

2003-01-19 Thread Sabina A. Schneider
I am writing to you to report a problem, which I haven't found in the
FAQs and errors. I have installed Apache 1.3.27 for Windows, with PHP4 and
Mysql 1.4 and when I try to see a page, that contains sessions there appears
an error- window that says that Windows closes Apache, because it has
genereted a problem. I search in the Apache logs but nothing appears. I've
followed the php code that I've generated and the problem is where the
script tris to register a variable. I attach here my php.ini that I'm using
in C:\Winnt .Thank you very much for your help and time.
  Sabina Alejandra Schneider
[EMAIL PROTECTED]



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


[PHP-DB] is this possible?

2003-01-19 Thread Addison Ellis
hello,
	i have a page where the user selects a category. they are 
directed to a page that takes them to subactegory and displays the 
subcategory according to category id.
	my question is can i from there direct them to a particular 
page from a list of a number of different pages according to their 
subcategory choice? my thought was to direct them to one page that 
contains all the relations between category and subcategory and if 
subcategory=id where category=$category then include or header 
example.php.
	i wasn't even sure about that.
	anyway... thank you for your time and thoughts. best, addison
--
Addison Ellis
small independent publishing co.
114 B 29th Avenue North
Nashville, TN 37203
(615) 321-1791
[EMAIL PROTECTED]
[EMAIL PROTECTED]
subsidiaries of small independent publishing co.
[EMAIL PROTECTED]
[EMAIL PROTECTED]

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



[PHP-DB] Array help please

2003-01-19 Thread Dave Carrera
Hi All
I am trying to create a tld lookup script for uk and main us domains.
 
I have success by creating multiple function hardcode the whois server
and tld but I would love to be able to make an array of tlds then step
through the array to check availability of domain.
 
Example
 
$arr = array(‘.co.uk’,’.com’,’.net’,’.me.uk’);
 
How do I step though one at a time and give a viewable result?
 
I know I have to check the value of the array and assign the relevant
whois server. How do I do that?
 
Any help, guidance, code examples will be very much appreciated.
 
Thank you in advance as always
 
Dave Carrera

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.443 / Virus Database: 248 - Release Date: 10/01/2003
 



[PHP-DB] Re: Email to a list of address in your database.

2003-01-19 Thread Adam Royle
This should work. You were on the right track, although you might want to
use better var names so you don't get confused. You can see I have changed
them to what I would normally use.

Adam

?php
$sql = select * from users;
$result = mysql_query($sql, $connection) or die(Couldn't execute
query.);

while($row = mysql_fetch_array($result)) {
 $to[] = $row['emailAddress'];
}

$mailTo = implode(;,$to);
?
pa href=mailto:?= $mailTo ?mail To all my list/a/p


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




Re: [PHP-DB] Array help please

2003-01-19 Thread Peter Beckman

$arr = array(.co.uk,.com,.net,.me.uk);
echo Top Level Domains: ;
while(list(,$tld)=each($arr)) {
   echo $tld., ;
}

On Sun, 19 Jan 2003, Dave Carrera wrote:

 Hi All
 I am trying to create a tld lookup script for uk and main us domains.

 I have success by creating multiple function hardcode the whois server
 and tld but I would love to be able to make an array of tlds then step
 through the array to check availability of domain.

 Example

 $arr = array(‘.co.uk’,’.com’,’.net’,’.me.uk’);

 How do I step though one at a time and give a viewable result?

 I know I have to check the value of the array and assign the relevant
 whois server. How do I do that?

 Any help, guidance, code examples will be very much appreciated.

 Thank you in advance as always

 Dave Carrera

 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.443 / Virus Database: 248 - Release Date: 10/01/2003



---
Peter Beckman  Internet Guy
[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] export 2 values for function

2003-01-19 Thread Ruprecht Helms
Hi,

how have I to define the calling and a function to work with
two values exported to a function that return one result.

Concret I want to include a grouped-price-function in a shopping-application.
The function to find the right price needs the product_id and the quantity.
It returns the product-price related to the price-group which is defined for the
quantity.

Regards,
Ruprecht

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




Re: [PHP-DB] Design suggestions - performance improvement

2003-01-19 Thread leo g. divinagracia iii
Matthew Nock wrote:

Hi all,

I am currently building a site for a cinema to display session times, film synopsis' etc...

I have built the database as follows:

TABLE:  film_detail
FilmID
FilmName
FilmRunTime
FilmRating
FilmSynopsis
etc...

TABLE  session_data
session_ID
session_filmID
session_StartTime
session_Date





normalize the SESSION_DATA more.

i would:

table:film_date
fd_id
fd_filmid
fd_date

table: session_data
sd_id
sd_fd_id (- foreign key)
sd_starttime

psuedo code:

print movie info
for (movie)

  select fd_date from film_date where fd_filmid = filmID
  print fd_date
  for (filmID - fd_date)

 loop
select sd_starttime from session_data where fd_id = sd_fd_id
print sd_starttime
 end loop

  next fd_date

next movie


film_detail has a 1 to many to film_date
film_date has a 1 to many to session_data


--
---
Leo G. Divinagracia III
[EMAIL PROTECTED]


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




Re: [PHP-DB] Help with MySQL

2003-01-19 Thread leo g. divinagracia iii
Rodrigo Corrêa wrote:

I´m new with MySQL, i´m just wondering if there is a way to get the IP from a MySQL Server, since i acess this by localhost in the webserver



even if you could, the MYSQL admin probably set your account to access 
your data with a LOCALHOST permission only...  so if you try to access 
your data, the system would not let you in.

this is common.


--
---
Leo G. Divinagracia III
[EMAIL PROTECTED]


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



[PHP-DB] header?

2003-01-19 Thread Addison Ellis
hello,
	i have a page where the user selects a category. they are 
directed to a page that takes them to subactegory and displays the 
subcategory according to category id.
	my question is can i from there direct them to a particular 
page from a list of a number of different pages according to their 
subcategory choice? my thought was to direct them to one page that 
contains all the relations between category and subcategory and if 
subcategory=id where category=$category then include or header 
example.php.
	i wasn't even sure about that.
	anyway... thank you for your time and thoughts. best, addison
--
Addison Ellis
small independent publishing co.
114 B 29th Avenue North
Nashville, TN 37203
(615) 321-1791
[EMAIL PROTECTED]
[EMAIL PROTECTED]
subsidiaries of small independent publishing co.
[EMAIL PROTECTED]
[EMAIL PROTECTED]

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



Re: [PHP-DB] difference between two dates

2003-01-19 Thread Rajesh Fowkar
On Sun, Jan 19, 2003 at 09:34:02AM -0500, John W. Holmes wrote:

 I tried this :
 
 $dobtimestamp = mktime(0,0,0,$cboMM,$cboDD,$cboYY);
 $todaytimestamp = time();
 $txtAge = ($todaytimestamp - $dobtimestamp)/86400;
 
 It does not give me the expected output.
 
 Can anybody suggest something ?

Keep your mktime() as it is, that's correct. Then use something like
this to calculate the age:

$age = date('Y',$now) - date('Y',$dob) -
((date('z',$now)=date('z',$dob)) ? 0 : 1);

where $dob and $now are the appropriate unix timestamps that you've
already got calculated with mktime() and time().

Thanks a lot. 

Peace

--
Rajesh
:
[ GNU/Linux One Stanza Tip (LOST) ]###

Sub : ext3 file system   LOST #034

To implement ext3 filesystem have a good look here (Cool) :
http://www.uow.edu.au/~andrewm/linux/ext3/ext3-usage.html

[EMAIL PROTECTED]###
:

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