[PHP-DB] Adding time in php

2006-03-03 Thread Allan
Hi All

I have two tables with columns of times that it took to perform tasks eg:

  8:40
  6:50
  8:30
10:55
-
34:55 total time taken to complete the tasks in hours and minutes

I am able to add the times with sql however I need to add the totals to cone
up with a grand total and because of the makeup of the tables I cant use
sql. I am there for going to have to use php code and this is where the
problem comes in because in sql there is SEC_TO_TIME and TIME_TO_SEC
functions that allow easy addition of the times but I cant find an
equivalent in php. Does any one know of a way that I can add to times
together in php.

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



[PHP-DB] Adding times in php

2006-03-03 Thread Allan
Hi All

I have two tables with columns of times that it took to perform tasks eg:

  8:40
  6:50
  8:30
10:55
-
34:55 total time taken to complete the tasks in hours and minutes

I am able to add the times with sql however I need to add the totals to cone
up with a grand total and because of the makeup of the tables I cant use
sql. I am there for going to have to use php code and this is where the
problem comes in because in sql there is SEC_TO_TIME and TIME_TO_SEC
functions that allow easy addition of the times but I cant find an
equivalent in php. Does any one know of a way that I can add to times
together in php.

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



[PHP-DB] more values in a array

2003-01-04 Thread Martin Allan Jensen
Hi everybody,

I'm about to transport data from a function to a page that calls it, but i'm HAD to 
make the data's in one or more array's.

How can i possibly put all these datas in an array ?? And is it possible ??

idvalueyeartype
--+---+-+-+
1  1002002 P
2  2002002 A
3  3002002 P
4  4002002 A

I hope you understand my bad english and that you can help me...

Thanks a lot just for reading this!

Regards,
Martin Allan Jensen


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




[PHP-DB] flytte bsd harddisk til anden pc

2002-12-12 Thread Martin Allan Jensen
Hej Allesammen, har et strt problem, jeg skal IDAG skifte server, men kan jeg bare 
tage mine harddiske med FreeBSD på og smide over i den nye maskine og så vil det køre 
eller 


[PHP-DB] adding in array

2002-12-10 Thread Martin Allan Jensen
Hi all,

I have a problem i know you can help me with.

I have this flushet out from a loop command:
Year: 2000  ID: 14  Value: 300
Year: 2002  ID: 11  Value: 640
Year: 2002  ID: 10  Value: 100
Year: 2003  ID: 11  Value: 200
Year: 2004  ID: 11  Value: 150
Year: 2005  ID: 11  Value: 250

I need PHP to put it into an array, but if it's the same YEAR the it's supposed to add 
the two values, so if i made a flush of the arrayt it would say somthing like:
Array( [0] = Array ( [2000] = 300) [1] = Array( [2002] = 740 ) [2] = Array( 
[2003]  = 200)  [4] = Array( [2004]  = 150) [5] = Array( [2005]  = 250))

So here is the little plan,
I only got the values in a variable in a loop, so i guess firstly putting it into an 
array could be a good idea, then add it and put it into an array again so i can flush 
the output, but i'm really bad at array (and english) so i really hope that you will 
help me.

I hope you get it, Thanks A lot for your help !!

BEST Regards,
Martin Allan Jensen


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




[PHP-DB] mysql select last year

2002-12-05 Thread Martin Allan Jensen
Hi all,

I have a little problem i know that you can help me with...

I have a mysql table
+--+
|  year  |   id  |
+
| 2002 |  11  |
| 2003 |  11  |
| 2004 |  11  |
| 2005 |  11  |
| 2001 |  12  |
| 2002 |  12  |
+-+-+

And then i have a loop that takes the year and value for each of them. But how can i 
check if there is for example a year for id 11 that is  than 2002

Thanks a LOT!

Regards,
Martin Allan Jensen



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




[PHP-DB] Assign a variable with another variables value

2002-12-01 Thread Martin Allan Jensen
Hi folks,

I probably need a little help the next couble of days, but well here is the first 
question.

How can i assign a variable with the value of another variable ??

Example:
$foo = BAR;

$newBAR = some string;

The BAR is supposed to be taken from the value of $foo.

THANKS A LOT!!!

Regards,
Martin Allan Jensen



[PHP-DB] arrays

2002-11-21 Thread Martin Allan Jensen
Hi everyone,

I have a problem sorting my data,

I have an array with a flush of values and years from a mysql database.

When i have all the values i need php to only print the values, and then group it by 
year souch that if i had an array that looked like this:
Array([2002] = 20,[2002] = 40,[2003] = 93)
Then it would print
2002 = 60
2003 = 93

Thanks a lot


Best regards,
Martin A Jensen


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




[PHP-DB] standart variabels melfunction

2002-11-19 Thread Martin Allan Jensen
Hi all,

I have a problem with my settings of Apache and PHP i think..

When i call for example ($PHP_SELF) instead of ($_SERVER[PHP_SELF]) i get no output, 
just like when i call the url
www.servername.tld/test.php?mode=test
And i want to call the mode like this:
print($mode);
I just get a empty string.
But when i call:
print($_GET[mode]);
I get the real output...

I tried to walk troug the hole php.ini  the httpd.conf file, but nothing came up, so 
i relly hope that you can help me out here...!

Sorry if it's a little off topic..

And THANKS A LOT!!

Regards
Martin Allan Jensen



[PHP-DB] Arrays again

2002-11-13 Thread Martin Allan Jensen
Hi everyone,

I need a little help again

I have a array with 4 values:

320 - 570 - 860 - 960

Each time it extracts one value it's supposed to take minus it with the old value. So 
that the output for the array above would be:

320 - 250 - 290 - 100

I hope you get the point and you're able to help me...

FIRST im a totally jerk to ARRAYS

THANKS !!!


Regards Martin Allan Jensen


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




[PHP-DB] Arrays again again

2002-11-13 Thread Martin Allan Jensen
Sorry fellers

Allready figured it outsorrynow i see that the question was foolish

Anyway now i need help with something else...

I now have some values:
320  -  250  -  290  -  100
And years that fits to them:
2002 - 2003 - 2004 - 2005

How can i put these dynamic values in a array. be carefull cause i need the array 
to be filled active in a loop, so i CAN only define ONE year, and ONE value in each 
LOOP!

THANKS!!!


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




[PHP-DB] array sorting

2002-11-12 Thread Martin Allan Jensen
Hi everyone...


I got a bit longer now..

But i have some trouble sorting my arrays

I get this array returned.

Array ( [0] = Array ( [0] = 10 [1] = 40 [2] = 50 [3] = 80 [4] = 130 [5] = 220 
[6] = 320 ) [1] = Array ( [0] = 10 [1] = 40 [2] = 50 [3] = 80 [4] = 130 [5] = 
220 [6] = 320 [7] = 440 [8] = 570 ) [2] = ) 

I ain't good at it, but i guess this is a two dimesioned array...

The question is now,  i need to get the highest values of each sub array witch would 
be 320  570 in THIS CASE ??

Thanks so much!!

Martin Allan Jensen


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




[PHP-DB] php array max value pr. year

2002-11-11 Thread Martin Allan Jensen
Hi evryonei have a problem that i hope you can help me with.

Here it goes!

I have two arrays one called y adn one called v 
Togeather they hold a year(Y) and a value(V)

The array looks like this:

v:
10
20
40
60
320
780
890
920

y:
2002
2002
2002
2002
2002
2003
2003
2003

-

V represents a climping value
Y represents the year of the value


So  the values 10, 20, 40, 60, 320 etc. grows until a new year is reachet. And then it 
schould start again in the new year.
So MAXIMUM ONE VALUE PER YEAR

How can i make it return this out of the earlier menchent array :

(Arrays)
Y:
2002
2003

V:
320
920

So much thanks peoplei tried now for two days and i just can't come up with 
anything...

P.S. Sorry for my bad english!

Martin Allan Jensen


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




[PHP-DB] arrays db

2002-11-11 Thread Martin Allan Jensen
Okey people, i try again!!

I have a table in a mysql database that holds this:
+++++--+
| id | maaler | aflaest| vaerdi | pris |
+++++--+
| 21 | 11 | 2002-01-01 |  15160 | 0.00 |
| 22 | 11 | 2002-02-01 |  15180 | 0.00 |
| 23 | 11 | 2002-03-01 |  15200 | 0.00 |
| 24 | 11 | 2002-04-01 |  15240 | 0.00 |
| 25 | 11 | 2002-05-01 |  15250 | 0.00 |
| 27 | 10 | 2002-11-14 |210 | 0.00 |
| 30 | 10 | 2002-12-19 |230 | 0.00 |
+++++--+

Each maaler have it's own start registration witch is:
++--+---+
| id | nummer   | start |
++--+---+
| 10 | 56456|   200 |
| 11 | 02   | 15150 |
++--+---+

I then made a script that takes start for each maaler if it have any 
registrations. Then it does this:
if its first field then it takes the vaerdi(THE VALUE) and - it with the start 
(THE STARTREGISTRATION) For the next fields it takes the vaerdi - the last vaerdi. 
My problem is that after the script has ran it have lets say 20 yeas 2002 (the 
registration year called aflaest in the table) and lets say two 2003. I only need 
ONE value vaerdi per year, witch is the one it just calculated in a loop. But it 
have all the values and years in the array. How do i only take ONE value per year in 
PHP NOT SQL??

I really hope this is discriping enough!!

THANKS ALL!


Martin Allan Jensen



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




[PHP-DB] mysql_connect()

2002-02-12 Thread Martin Allan Jensen

Hi all. once again i need help...

I tried a lot of  stuff but my server (linux) (php 4.0.6) won't use the 
mysql_connect() command..??

Anyone else have an solution for the problem..??


Kind regards
Martin Allan Jensen



[PHP-DB] mysql_connect()

2002-02-12 Thread Martin Allan Jensen

Sorry folks, last time i wrote it to fast! Well here is the hole story

We got an organisation to install a new version of phpmyadmin, mySQL and PHP 4.0.6 on 
our Cobalt Raq 4r server (Linux)

They got it installed and phpmyadmin is working finebut when i call fro a script 
souch as
%
?
// Connecting, selecting database
$link = mysql_connect(127.0.0.10, phpcoder_dk, pdw)
or die(Could not connect);
print Connected successfully;
mysql_select_db(phpcoder_dk)
or die(Could not select database);

// Performing SQL query
$query = SELECT * FROM hits;
$result = mysql_query($query)
or die(Query failed);
?
%

The script writes this.
%
Fatal error: Call to undefined function: mysql_connect() in 
/home/sites/site2/web/sql.php on line 3
%

You can test it at http://www.phpcoder.dk/sql.php

I really hope that someone will help me cause i really can't find the problem by 
myself...!

Kind regards
Martin Allan Jensen



[PHP-DB] mysql_connect() and phpmyadmin

2002-02-12 Thread Martin Allan Jensen

I just don't understand why phpmyadmin works with it when i can't call it.! I did 
try with localhost
but it won't still work..

PLEASE help i just can't understand it

Kind regards
Martin



-Original Message-
From: Martin Allan Jensen [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 12, 2002 10:44 AM
To: Rick Emery
Subject: Re: [PHP-DB] mysql_connect()


It wasen't me hwo did it! but why do phpmyadmin work fine then??



Martin
- Original Message - 
From: Rick Emery [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, February 12, 2002 5:29 PM
Subject: RE: [PHP-DB] mysql_connect()


 Re-read my previous email.  You do not have mysql functionality compiled
 into PHP and you web server.  The clue is the phrase undefined function:
 mysql_connect().
 How did you load PHP, MYSQL, etc?
 
 -Original Message-
 From: Martin Allan Jensen [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, February 12, 2002 10:26 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] mysql_connect()
 
 
 Sorry folks, last time i wrote it to fast! Well here is the hole
 story
 
 We got an organisation to install a new version of phpmyadmin, mySQL and
PHP
 4.0.6 on our Cobalt Raq 4r server (Linux)
 
 They got it installed and phpmyadmin is working finebut when i call
fro
 a script souch as
 %
 ?
 // Connecting, selecting database
 $link = mysql_connect(127.0.0.10, phpcoder_dk, pdw)
 or die(Could not connect);
 print Connected successfully;
 mysql_select_db(phpcoder_dk)
 or die(Could not select database);
 
 // Performing SQL query
 $query = SELECT * FROM hits;
 $result = mysql_query($query)
 or die(Query failed);
 ?
 %
 
 The script writes this.
 %
 Fatal error: Call to undefined function: mysql_connect() in
 /home/sites/site2/web/sql.php on line 3
 %
 
 You can test it at http://www.phpcoder.dk/sql.php
 
 I really hope that someone will help me cause i really can't find the
 problem by myself...!
 
 Kind regards
 Martin Allan Jensen
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php